Search code examples
wordpresswoocommercecartminicart

WooCommerce Mini Cart is coming Blank on add to cart from product page


In my WooCommerce shop, the mini cart in is coming blank when I am adding product from single product pages, but when adding product from home page through add to cart it shows up.

It started happening after I installed a plugin for direct checkout from the product page. as of I have deleted the plugin but still the issue remains.

Here is the url of the website (https://bakersvillagestore.com)

I tried some different solutions, but none of them worked. Here are the few things that I have tried to solve the issue.

  1. changing themes
  2. woo commerce > status > WooCommerce transients
  3. woo commerce > status > Clear customer sessions
  4. woo commerce > status > Clear template cache

I also tried few more things, without success.

Any help is appreciated.


Solution

  • As per the Woocommerce explanation, they have removed wc-cart-fragments to increase the performance. If you are using elementor, I believe now it's up to elementor to get a fix. I saw elementor mentioned on GIT that they would give a fix with the 3.14.0 release. Until that, the below code will fix the issue.

    Add this code to the function.php in the child theme or main theme (if you do not use a child theme)

    function enqueue_wc_cart_fragments() { wp_enqueue_script( 'wc-cart-fragments' ); }
    add_action( 'wp_enqueue_scripts', 'enqueue_wc_cart_fragments' );