Home › Forums › Front-end Issues › Display Custom Fields At Thank You WOOComerce Page › Reply To: Display Custom Fields At Thank You WOOComerce Page
Hi @vicmar
If you’ve added custom fields to the billing form, this information is store against the order ID.
So on the thank you page, you need to access the order ID, then you should be able to access your custom field data.
For example:
$variable2 = get_field(‘billing_wooccm11’,$order_id);
I also believe this line is wrong:
add_action(‘woocommerce_thankyou’, ‘action_woocommerce_before_checkout_form’);
You’re trying to use a hook for the thank you page but mixed with an action on the checkout page (I may be wrong here!)
I think this is the correct hook:
function action_woocommerce_thankyou( $order_get_id ) {
// your code goes here
};
add_action( 'woocommerce_thankyou', 'action_woocommerce_thankyou', 10, 1 );
Or you could copy the thank-you.php file to your theme and add the code directly – obviously you need to still
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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.