Home Forums Reply To:

  • Hi,

    I created a custom field to add manually 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 my 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 );