WP Global Cart >
Update my custom theme cart to show correct product link
Update my custom theme cart to show correct product link
As default the links within cart should reflect the original shop where they pushed to the cart. In some cases a custom theme is not using the recommended WooCommerce template implementation which conclude to wrong url. Fortunate this is a small update, explained in the following lines.
Many themes use something like this to output the cart:
global $woocommerce;
$carts = array_reverse( $woocommerce->cart->get_cart() );
foreach ( $carts as $cart_item_key => $values ) : ?>
<?php $_product = $values['data'];
if ( $_product->exists() && $values['quantity'] > 0 ): ?>
<div class="product">
... more code ...
</div>
<!--/product -->
<?php endif; ?>
<?php endforeach; ?>
This need a bit of update to include the switch_to_blog() and restore_current_blog() so add the 2 new lines:
global $woocommerce;
$carts = array_reverse( $woocommerce->cart->get_cart() );
foreach ( $carts as $cart_item_key => $values ) : ?>
<?php do_action( 'woocommerce/cart_loop/start', $values ); ?>
<?php $_product = $values['data'];
if ( $_product->exists() && $values['quantity'] > 0 ): ?>
<div class="product">
... more code ...
</div>
<!--/product -->
<?php endif; ?>
<?php do_action( 'woocommerce/cart_loop/end', $values ); ?>
<?php endforeach; ?>
At this point the products within the cart, pushed on other shops will use the correct links back to original shop.
Related Posts
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...
Name: woogc/get_cart_from_session/validate_hash
Type: Filter
Arguments: $force_validation, $values
When reconstructing...
Incredibly flexible, the WooCommerce...
On the Synchronization screen...