Home › Forums › General Issues › Showing ACF Field on WooCommerce order page › Reply To: Showing ACF Field on WooCommerce order page
I finally found a solution to this.
I needed to have a DHL number in my orders page – so when I shipped the order, I put in the DHL number in that field and it should show up in the order.
That’s how I did it in my functions.php:
add_action ('woocommerce_order_details_after_order_table', 'optigem_sendungsnummer', 20);
function optigem_sendungsnummer( $order ) {
if (get_field('sendungsnummer', $order->id)) { // Only show if field is filled
?>
<p class="sendungsnummer">DHL: <?php the_field('sendungsnummer', $order->id); ?><p>
<?php
}
}
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.