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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.