WIP: Ajax does not work for error type notice

Browser: Chrome 120
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

I had a product that had 2 inventories. After adding the product to the cart twice, the ajax notification was displayed properly. But after I clicked the add to cart button for the third time, the error message (You cannot add that amount to the cart — we have 2 in stock and you already have 2 in your cart) was displayed, but the page was reloaded and not displayed as Ajax.

Hi @jolia ,

Thanks for posting this.

This is the expected result as Bricks tried to follow the native WooCommerce AJAX add to cart behavior in the shop page.

You can turn OFF the AJAX add to cart in Bricks > Settings > WooCommerce, and test in the Shop page.
In WooCommerce native AJAX add to cart, (Ajax call: wc-ajax=add_to_cart), any error when performing add to cart action will redirect to the product page.

However, I have added this to the improvement task.

Regards,
Jenn

1 Like