Last active
June 23, 2020 06:35
-
-
Save zorem/577b2e312de71122194cc943ab0812a8 to your computer and use it in GitHub Desktop.
How to get a tracking details of order for AST and include tracking details in emails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( class_exists( 'WC_Advanced_Shipment_Tracking_Actions' ) ) { | |
$order_id = 123; | |
$wc_ast_unclude_tracking_info = get_option('wc_ast_unclude_tracking_info'); | |
$order = wc_get_order( $order_id ); | |
$order_status = $order->get_status(); | |
if ( is_a( $email, 'WC_Email_Customer_Invoice' ) && isset($wc_ast_unclude_tracking_info['show_in_customer_invoice']) && $wc_ast_unclude_tracking_info['show_in_customer_invoice'] == 0){ | |
return; | |
} | |
if(isset($wc_ast_unclude_tracking_info[$order_status]) && $wc_ast_unclude_tracking_info[$order_status] == 0 && !is_a( $email, 'WC_Email_Customer_Invoice' )){ | |
return; | |
} | |
if ( function_exists( 'ast_get_tracking_items' ) ) { | |
$tracking_items = ast_get_tracking_items($order_id); | |
wc_get_template( 'emails/tracking-info.php', array( 'tracking_items' => $tracking_items, 'order_id'=> $order_id ), 'woocommerce-advanced-shipment-tracking/', wc_advanced_shipment_tracking()->get_plugin_path() . '/templates/' ); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment