WPCommerce MultiDomain WPCommerce MultiDomain
  • 0
    • No products in the cart.
    • Home
    • Features
    • Pricing
    • Documentation
    • FAQ
    • Articles
    • Contact
    • My account
    WPCommerce MultiDomain WPCommerce MultiDomain
  • 0
    • No products in the cart.
    • Home
    • Features
    • Pricing
    • Documentation
    • FAQ
    • Articles
    • Contact
    • My account
    WPCommerce MultiDomain

    Documentation

    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 );
            }
    

    Leave a Reply Cancel reply

    Recent Posts

    • Easy Multilingual and Multi-Currency WooCommerce Shop November 18, 2022
    • Why use WP Multi Domain for WooCommerce with default WordPress instance over MultiSite environment May 9, 2022
    • Selecting the Checkout Type option – Single Checkout / Each Store September 22, 2021

    Social Links

    @2022. All Rights Reserved

    Terms & Conditions | Privacy Policy

    Latest Articles

    • Easy Multilingual and Multi-Currency WooCommerce Shop
      Using the WooCommerce Multi Domain, managing the WooCommerce Products has never been easier. Multiple Domains...
    • Why use WP Multi Domain for WooCommerce with default WordPress instance over MultiSite environment
      Creating a centralised network of shops isn’t a straightforward implementation. That requires a lot of...
    • Selecting the Checkout Type option – Single Checkout / Each Store
      The WordPress WPCommerce Multi-Domain includes the global shopping cart functionality which allows a customer to...

    nspcode Follow

    @ ·
    now

    Reply on Twitter Retweet on Twitter Like on Twitter Twitter
    Load More