HomePage Forums Themes Support Guides theme Instructions to fix the error of shopping cart is empty

Topic Resolution: Resolved
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #33733

    Shopping cart error when adding products to cart occurs due to conflict with Elementor Pro plugin version 3.12: https://prnt.sc/7fuYnsffVRi1

    To fix this problem, please add the following code in your functions.php file (child-theme):

    if(class_exists('WooCommerce')) {
        add_filter( 'woocommerce_add_to_cart_fragments',  'elementor_pro_cart_count_fragments' , 1, 9999 );
    
        function elementor_pro_cart_count_fragments($fragments) {
    
            ob_start();
            woocommerce_mini_cart();
            $mini_cart = ob_get_clean();
            $fragments['div.widget_shopping_cart'] = '<div class="widget woocommerce widget_shopping_cart"><div class="widget_shopping_cart_content">' . $mini_cart . '</div></div>';
    
            return $fragments;
        }
    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.