Last active
April 11, 2022 12:49
-
-
Save zorem/60b833b32830d9656c01f88707ce4532 to your computer and use it in GitHub Desktop.
Below is the code snippet for get formatted tracking info
This file contains 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 | |
// Check if function exist | |
if ( function_exists( 'ast_get_tracking_items' ) ) { | |
$order_id = 123; // Replace with your order_id | |
$tracking_items = ast_get_tracking_items($order_id); | |
foreach($tracking_items as $tracking_item){ | |
$tracking_number = $tracking_item['tracking_number']; | |
$tracking_provider = $tracking_item['formatted_tracking_provider']; | |
$tracking_url = $tracking_item['formatted_tracking_link']; | |
$date_shipped = date_i18n( get_option( 'date_format' ), $tracking_item['date_shipped'] ); | |
// Tracking per item info | |
$products_list = $tracking_item['products_list']; | |
foreach($products_list as $product){ | |
$product = wc_get_product( $product->product ); | |
$qty = $product->qty; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment