Created
January 12, 2023 06:37
-
-
Save theRealRizeo/6e5f8afa701b6f74dc64a96e74904082 to your computer and use it in GitHub Desktop.
WooCommerce Amazon FBA Order tracking cron
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 | |
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