Support

Account

Home Forums Front-end Issues get_field not returning a specific value

Solving

get_field not returning a specific value

  • i used <?php the_field( ‘cancellation_policy’ ); ?> code to call the data on checkout page.
    But it is returning any data.

  • Not really enough information so I’m guessing

    Is the field ‘cancellation_policy’ on an options page?

    
    <?php the_field('cancellation_policy', 'options'); ?>
    
  • For of all thank you for reply,
    I have a tours and travel website. I want to show the cancellation policy related to particular package on the checkout Page. So for that firstly i create a field groups named cancellation policy under the tours. and so to use the package policy i used the get_field code on checkout page.

  • The checkout page is not for a specific post. You need to supply the correct post ID to get the field from.

    I am not familiar with how to do this, check with the eCommerce plugin you’re using to find out how to get the post ID of each item in the checkout and supply that ID when calling the ACF function.

    
    <?php the_field('cancellation_policy',$post_id); ?>
    
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘get_field not returning a specific value’ is closed to new replies.