Adding Tracking Number to Custom Email Template

nadeeem

New Member
I have a plugin (automatewoo) which makes custom email template for woocommerce default templates.It replaces the default templates with its custom format. The problem is there is noway to add the available tracking number to "order complete" email. The Plugin (automateWoo) just allow us to customize the email template with this WYSIWYG HTML Editor Now, I have lidropship woo which fetches the tracking code once its available and sends it to customer automatically with the Default email template. but I use my custom email template, I turned off the default "order complete" tempalte for woocommerce.

After I contacted the alidropship support they gave me the following snippet of code which takes an corresponding item id and order id and return tracking number.But I cant add this to my child theme with hook because I dont use default order complete email template. Hence,I just wonder if there is a way this function can be made as wordpress SHORT CODE, so that I can put that shortcode in my emial html template. The function needs more work to get the item n order id. If u can do this, it wud be useful for many people who use custom email template.

Code:
function get_tracking($item_id, $order)

{ $ord = new \adsw\adsOrdersView( $item_id, $order→get_id() );

if( empty($ord→get_prop( ‘adsw_tip’ )) ) return null;
$tracking_link = get_option( ‘adsw-tracking’, ‘17track’ );
return [
‘order_number’ => $ord→get_prop( ‘adsw_order_number’ ),
‘url’ => adsw_get_tracking_url( $tracking_link ) . $ord→get_prop(
‘adsw_tip’ ),
‘id’ => $ord→get_prop( ‘adsw_tip’ )
];
}

where $order – order object in WooCommerce
$item_id – position ID in order
 
Top