Home Forums Feedback ACF order email tracking number


ACF order email tracking number

  • Hi,

    I created a custom field to add the tracking number in the woocommerce order page.

    The problem is that in order to work, I have to fill in the field, save the page, then I have to change the order to complete and resave the page.

    It’s like if the information entered in the field was not saved. Is there a way I can add a save button under my custom field? This could fix the issue.

    The information entered would be registered in the wordpress DB and then I could only switch the order status to complete, in order to send the tracking number to the client.

    Here is the 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('trackingnumberups', $order->get_id())) { // Only show if field is filled
            <h3>Your tracking number: <?php the_field('trackingnumberups', $order->get_id()); ?></h3>
            You may track your order with the number above, here: <a style="color: #0073aa;" href="">UPS Tracking</a> 
    // add the action 
    add_action('woocommerce_email_before_order_table', 'action_woocommerce_email_before_order_table', 10, 4 );
Viewing 1 post (of 1 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.