Search
woogc/checkout/single/split/blog_id - WP Global Cart
15649
documentation-template-default,single,single-documentation,postid-15649,theme-awake,eltd-core-1.1,woocommerce-no-js,awake child-child-ver-1.0.0,awake-ver-1.0,eltd-smooth-scroll,eltd-smooth-page-transitions,eltd-mimic-ajax,eltd-grid-1200,eltd-blog-installed,eltd-default-style,eltd-fade-push-text-top,eltd-header-standard,eltd-sticky-header-on-scroll-down-up,eltd-default-mobile-header,eltd-sticky-up-mobile-header,eltd-menu-item-first-level-bg-color,eltd-dropdown-slide-from-top,eltd-,eltd-fullscreen-search eltd-search-fade,eltd-side-menu-slide-from-right,wpb-js-composer js-comp-ver-6.3.0,vc_responsive
 

woogc/checkout/single/split/blog_id

WP Global Cart / woogc/checkout/single/split/blog_id
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

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.

0
Would love your thoughts, please comment.x
()
x