Skip to content

Instantly share code, notes, and snippets.

@zorem
Last active April 12, 2022 04:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zorem/7acdd3906e68721c0f20d3905e79f780 to your computer and use it in GitHub Desktop.
Save zorem/7acdd3906e68721c0f20d3905e79f780 to your computer and use it in GitHub Desktop.
Add tracking info into orders
<?php
// Check if AST PRO plugin is Installed
if ( class_exists( 'AST_Pro_Actions' ) ) {
$order_id = '123'; //Replace with your order id
$tracking_provider = 'USPS'; //Replace with your shipping provider
$tracking_number = '123123'; //Replace with your tracking number
$date_shipped = '2020-06-22'; ////Replace with your shipped date
$status_shipped = 1; // 0=no,1=shipped,2=partial shipped(if partial shipped order status is enabled)
$sku = 't-shirt,blue-jeans'; //the line item (product) SKU
$qty = '1,1'; //the line item (product) quantity
if ( function_exists( 'ast_insert_tracking_number' ) ) {
ast_insert_tracking_number( $order_id, $tracking_number, $tracking_provider, $date_shipped, $status_shipped, $sku, $qty );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment