Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theRealRizeo/6e5f8afa701b6f74dc64a96e74904082 to your computer and use it in GitHub Desktop.
Save theRealRizeo/6e5f8afa701b6f74dc64a96e74904082 to your computer and use it in GitHub Desktop.
WooCommerce Amazon FBA Order tracking cron
<?php
function custom_mcf_check_order_tracking_details() {
global $ns_fba_inst;
if ( ! is_object( $ns_fba_inst ) ) {
return;
}
$orders = get_posts(
array(
'numberposts' => 20,
'order' => 'ASC',
'post_type' => 'any',
'post_status' => array( 'wc-sent-to-fba', 'wc-part-to-fba' ),
)
);
if ( empty( $orders ) ) {
return;
}
foreach ( $orders as $f_order ) {
$ns_fba_inst->fulfill->get_fulfillment_order_shipping_info( $f_order->ID );
}
}
add_action( 'custom_mcf_check_order_tracking_details_action', 'custom_mcf_check_order_tracking_details' );
if ( ! wp_next_scheduled( 'custom_mcf_check_order_tracking_details_action' ) ) {
wp_schedule_event( time(), 'daily', 'custom_mcf_check_order_tracking_details_action' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment