Redirect all Carts to a specific Shop Cart
Each of the Network Shops run their own cart page. This can be changed so the cart link redirects the user to a specific Shop Cart in the network, which is usually the Check-out Shop, when using Single Site Check-out type.
The feature can be achieved through a custom code. The WOOGC_REQUIRED_CART_URL value should be updated with the required shop cart URL:
<?php
define('WOOGC_REQUIRED_CART_URL', '--MainShopDomain--/cart/');
add_action('init', 'custom_init');
function custom_init()
{
ob_start( "custom_ob_callback");
}
function custom_ob_callback( $buffer )
{
$current_site_url = wc_get_cart_url();
$current_site_url = preg_replace('/:[0-9]+/', '', str_replace(array ("https://" , "http://"), "", $current_site_url ));
$current_site_url = trailingslashit( $current_site_url );
$buffer = str_ireplace( $current_site_url, WOOGC_REQUIRED_CART_URL, $buffer);
//jsonencoded replacements
$buffer = str_ireplace( trim( json_encode( $current_site_url ), '"' ) , trim( json_encode( WOOGC_REQUIRED_CART_URL ), '"' ) , $buffer );
return $buffer;
}
?>
*The code should be placed into a custom file on /wp-content/mu-plugins/ or theme functions.php
Related Posts
Name: woogc/ps/interfaces/synchronize_to_sites
Type: Filter
Arguments: $sites
The filter...
When utilizing the Single...
WPGlobalCart is a powerful WooCommerce plugin designed to streamline e-commerce operations within a WordPress MultiSite network. It offers a range of tools and features that simplify product management, making it an essential tool for businesses with multiple online stores.
Product Synchronization Made Easy
One of the standout features of the WPGlobalCart plugin is its user-friendly and efficient approach to product synchronization. Managing a diverse range of products across multiple websites within a WordPress MultiSite network can be a complex and time-consuming task. However, WPGlobalCart streamlines this process, offering a set of tools and features that make product synchronization a breeze.
Starting version 3.8.5 WP Global Cart received a new functionality called “Replace the Cart Products with local version”.
The “Replace the Cart Products with local version” feature enhances the shopping experience for customers who are using the WP Global Cart plugin in a WordPress MultiSite environment. This feature specifically addresses situations where a product in the shopping cart is available in the current store.
Name: woogc/ps/synchronize_product/ignore_meta_key
Type: Filter
Arguments: $IgnoreMeta, $prop_title,...
Name: woogc/checkout/single/split/trigger_email
Type: Filter
Arguments: $status, $args
By default,...
The capability to Split...
Splitting Orders, is a...
The Synchronization procedure is...