woogc/checkout/single/split/blog_id
Name: woogc/checkout/single/split/blog_id
Type: Filter
Arguments: $blog_id, $status
The filter can be used to disable Order Split for specific Shop, when using Single Check-out and Split Order functionality.
In the following code example, disable the split for shop ID’s 2:
add_filter('woogc/checkout/single/split/blog_id', '__WooGC_single_checkout_split_order_blog_id', 10, 3);
function __WooGC_single_checkout_split_order_blog_id( $status, $_blog_id, $order )
{
if ( $_blog_id == 2 )
$status = FALSE;
return $status;
}
Also, for example, to disable the split order for shop ID 1, which is also the check-out area, when there are products only from shop ID 1 in the cart, the following code can be used:
add_filter('woogc/checkout/single/split/blog_id', '__WooGC_single_checkout_split_order_blog_id', 10, 3);
function __WooGC_single_checkout_split_order_blog_id( $status, $_blog_id, $order )
{
$order_items = $order->get_items();
$items_by_shop = array();
foreach ( $order_items as $order_item )
{
$_blog_id = $order_item->get_meta('blog_id');
$items_by_shop[ $_blog_id ][] = $order_item;
}
if ( count ( $items_by_shop ) === 1 && $_blog_id == 1 )
$status = FALSE;
return $status;
}
The code should be placed inside a php file on wp-content/mu-plugins folder.
