WP Global Cart >
☛ Properly Loop the Global Cart when contains products from different shops
☛ Properly Loop the Global Cart when contains products from different shops
Looping through the Cart Items is straightforward and achievable through the code:
$cart_items = WC()->cart->get_cart();
foreach ( $cart_items as $cart_key => $item )
{
//custom code
}
When the cart includes products from different shops ( within the MultiSite Network ), the same code can be used. Still, a switch to the product shop is required, for the inner code to be able to correctly retrieve the data. The easiest approach will be to add 2 actions as the example:
$cart_items = WC()->cart->get_cart();
foreach ( $cart_items as $cart_key => $item )
{
do_action( 'woocommerce/cart_loop/start', $item );
//custom code
do_action( 'woocommerce/cart_loop/end', $item );
}
The above hooks are the easiest approach to make a fix for 3rd codes that are not MultiSite capable and fail to process the cart contents. That ensures they fetch the products from the correct shop, instead of the current site.
Related Posts
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...
When running multiple Shops, a WordPress MultiSite environment is the optimal way to go. That provides a lot of interconnectivity possibilities, at an astonishing speed.
Our WooCommerce Global Cart plugin implements key features to make everything a robust, fast render and flexible marketplace.
The WooCommerce Product Synchronisation is a new powerful functionality recently introduced. This is designed to help with product synchronisation between multiple Shops in the network.
This newly implemented functionality helps with displaying WooCommerce Products across shops, in the network, under your WordPress MultiSite environment. Promote specific products, types of merchandise, category of goods, so boosting overall network sales. The new function is available as a Woocommerce Product Shortcode and is easy to implement. Any section of a site can include the shortcode to output the required products. The woocommerce shortcode is usable within the default WordPress editor ( classic ) or any advanced layout composer like Elementor, Divi, Visual Builder etc.
WooCommerce Tax area provides...