a
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudanti.
a
Follow Me
Search
woogc/disable_global_cart - WooCommerce MultiSite Global Cart
14496
documentation-template-default,single,single-documentation,postid-14496,theme-awake,cookies-not-set,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.0.3,vc_responsive
 

woogc/disable_global_cart

WooCommerce MultiSite Global Cart / woogc/disable_global_cart
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on TumblrPin on PinterestEmail this to someonePrint this page

woogc/disable_global_cart

Name: woogc/disable_global_cart
Type: Filter
Arguments: $is_disabled

The filter is being used to disable the Global Cart functionality. The Global Cart works as a unique cart for all shops in the MultiSite Network, a product pushed to the cart will be show on all other shops too.


    add_filter( 'woogc/disable_global_cart',     'WooGC_Disable_GlobalCart');
    function  WooGC_Disable_GlobalCart ( $status )
        {
            
            return TRUE;   
        }

The code should be placed inside a php file on wp-content/mu-plugins folder.

The Global Cart can be disabled for individual sites, the following code can be used, in this example the 3 and 4 are the sites ID which will be disabled:



    define ( 'WooGC_GC_Ignore_Sites', array( 3, 4 ) );
       
    
    add_filter( 'woogc/disable_global_cart',     'WooGC_Disable_GlobalCart');
    function  WooGC_Disable_GlobalCart ( $status )
        {
            
            global $blog_id;
            
            if (  in_array( $blog_id, WooGC_GC_Ignore_Sites ))
                return TRUE;   
                
            return $status;
            
        }
        
    add_filter( 'woogc/save_session_data/ignore_sites',     'WooGC_Save_Session_Data');
    function  WooGC_Save_Session_Data ( $sites  =   array() )
        {
                
            return WooGC_GC_Ignore_Sites;
            
        }