When Splitting the order, show only split transactions on the checkout shop
Splitting Orders, is a powerful tool when working with separate shop managers and merchants. That helps to create split orders with products that belong to different shops in the network. So each of the shops that had at least one product in the cart, will receive an order with its own products.
A split can be ignored for the shop, where the check-out occurs. Or the main order can be hidden, on the checkout site and show the split Order instead, to avoid confusion. That can be achieved through a custom code.
The following code should be placed in a custom file inside you /wp-content/mu-plugins folder. If the folder does not exist on your WordPress, you should create it manually.
add_action ( 'pre_get_posts' , '_pre_get_posts'); function _pre_get_posts( $query_object ) { global $blog_id, $WooGC; $plugin_options = $WooGC->functions->get_options(); if ( $plugin_options['cart_checkout_type'] != 'single_checkout' ) return; if ( $blog_id != 1 ) return; if ( ! is_admin() || strpos( $_SERVER['SCRIPT_NAME'], '/edit.php' ) === FALSE || strpos( $_SERVER['REQUEST_URI'], 'post_type=shop_order' ) === FALSE ) return; $query_object->query_vars['meta_key'] = 'checkout_order_id'; $query_object->query_vars['meta_value'] = '1'; $query_object->query_vars['meta_compare'] = '>'; }
The code automatically can pick up your check-out shop and check against that, before the code run:
add_action ( 'pre_get_posts' , '_pre_get_posts'); function _pre_get_posts( $query_object ) { global $blog_id, $WooGC; $plugin_options = $WooGC->functions->get_options(); if ( $plugin_options['cart_checkout_type'] != 'single_checkout' ) return; if ( $blog_id != $plugin_options['cart_checkout_location'] ) return; if ( ! is_admin() || strpos( $_SERVER['SCRIPT_NAME'], '/edit.php' ) === FALSE || strpos( $_SERVER['REQUEST_URI'], 'post_type=shop_order' ) === FALSE ) return; $query_object->query_vars['meta_key'] = 'checkout_order_id'; $query_object->query_vars['meta_value'] = '1'; $query_object->query_vars['meta_compare'] = '>'; }