WPCommerce MultiDomain
Loop though the Cart items
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 include 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 ); }