tracking number field in Woocommerce order

enter image description here

I need to create a custom field on Woocommerce order, where the admin will enter the tracking ID.

When the order is marked as completed in the email template i want to output this field value and send it to the customer.

Also i want to show it in the woocommerce track-order order page or show it as a note without sending an email.

So $fld variable should be the custom field we should create in the orders.

Your tracking number is: {$fld}

How can i do it? Thanks.

Woocommerce>order field:

oceanwp-child/woocommerce/emails/customer-completed-order.php

<?php /* translators: %s: Customer first name */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_billing_first_name() ) ); ?></p>
<?php /* translators: %s: Site title */ ?>
<p><?php printf( esc_html__( 'Your %s order is completed. Your tracking number is: {$fld}', 'woocommerce' ), esc_html( wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ) ); ?></p>

Read more here:: tracking number field in Woocommerce order

Leave a Reply

Your email address will not be published. Required fields are marked *