function Amz_FBA_Check_If_Orders_Need_Confirming() { global $wpdb; $args = array('meta_key' => 'FBA_Status', 'meta_value' => array('False', 'RECEIVED', 'PLANNING', 'PROCESSING'), 'post_type' => 'shop_order'); $OrderArray = get_posts($args); foreach ($OrderArray as $SingleOrder) { $ID = $SingleOrder->ID; GetAmzFBAOrderDetails($ID); } $OrderCount = count($OrderArray); if ($OrderCount == 0) { AmzFBA_Woo_Log("Neutral", "Order", "Order Status Update", "No orders currently require status updates."); } }
function Amz_FBA_Check_If_Orders_Need_Confirming() { global $post; $args = array('post_type' => 'shop_order', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array(array('taxonomy' => 'shop_order_status', 'field' => 'slug', 'terms' => array('processing')))); AmzFBA_Woo_Log("Neutral", "Order", "Order Status Update", "running order query"); $loop = new WP_Query($args); if (!$loop->have_posts()) { AmzFBA_Woo_Log("Neutral", "Order", "Order Status Update", "No orders found"); } while ($loop->have_posts()) { $loop->the_post(); $ID = $loop->post->ID; AmzFBA_Woo_Log("Neutral", "Order", "Order Status Update", "found order id " . $ID); GetAmzFBAOrderDetails($ID); } wp_reset_postdata(); }