Support

Account

Home Forums General Issues ACF refresh button Reply To: ACF refresh button

  • Hi,

    I am trying to update a custom field ( in the woocommerce order page). Once the field is saved, I then change the status email to complete and send the number into the order completion email. using this code:

    // define the woocommerce_email_before_order_table callback 
    function action_woocommerce_email_before_order_table( $order, $sent_to_admin, $plain_text, $email ) { 
        
        
        if (get_field('ACFFIELDNAME', $order->get_id())) { // Only show if field is filled
     
    ?>
            <h3>Your number: <?php the_field('ACFFIELDNAME', $order->get_id()); ?></h3>
                  
            <?php 
            
        }
    
    }; 
             
    
    // add the action 
    add_action('woocommerce_email_before_order_table', 'action_woocommerce_email_before_order_table', 10, 4 );