Mini Cart does not sync when WooCommerce AJAX buttons are used to add and remove products

Description:

We have added a mini cart using the Cwicly tutorial video. The only minor difference is we are displaying it in a Nav Dropdown rather than a Modal.

When we add or remove products using WooCommerce’s AJAX buttons (outside of the mini cart) the cart items and count do not update asynchronously, only on refresh of the page.

The reason I am adding this as a bug rather than a feature request is because in some places in the documentation it is implied that this should work.

Step-by-step reproduction instructions:

  1. Add a mini cart into your header template in a Nav Dropdown inside a Nav block.
  2. When viewing the site,
    a. add a product using WooCommerce buttons with AJAX enabled
    b. remove a product using the legacy basket or checkout template with AJAX enabled
  3. Note the mini cart does not update

Environment info

  • WordPress version: 6.3.2
  • Cwicly Plugin version: 1.3.2.2

@Araminta, let me know if you need any more information to be able to reproduce this.

@Louis, just following up on this one as we have multiple WooCommerce sites and we are about to release a new one that requires this to work for the mini cart.

@Louis Just following up on this - As we have a new site due to be released next week, we just need to know whether there is a chance this will be looked at / fixed.

I know you have been working on the Beta, which is the current priority, I am just checking so we can make a decision if we need to do this a different way.

Cheers.

Hello @StrangeTech,

The mini cart relies/listens to the WooCommerce blocks endpoints.

If you are using a classic WooCommerce template, this might be the issue as the AJAX call is not related to the new store calls?

@Louis Yes, we are using a classic WooCommerce template for the cart and checkout pages, and just using the ajax add to cart buttons for the product pages.

This definitely could be an issue as we have 3rd party WooCommerce related plugins that may not work with the WooCommerce blocks yet, which is why we chose the classic templates in the first place.

I am going to do some tests to see if I can isolate this and come up with a workaround, based on your idea.

For anyone else experiencing this, you can disable AJAX add to cart for the shop archive pages from WooCommerce settings: