Support

Account

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 
    		
    	}
    
    }