Disable the Global Cart on specified sites in the MultiSite Network
The WooCommerce Global Cart plugin code is cleverly built using the latest programming techniques, this allows high flexibility for the modules.
The Global Cart is the most important feature that the plugin can provide. As default, this is available on all network, whenever WooCommerce is available. In certain set-ups, not all shops are required to run a GlobalCart functionality, so might be required to be disabled. This can be achieved easily through a filter code.
The following sample code demonstrates how to disable the functionality for specified sites. The code should be placed within a file inside /wp-content/mu-plugins/ folder:
/** * Disable the Global Cart for sites ID 3 and 4 */ 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; }