AJAX "Add to Cart" not working

edited November 2023 in WooCommerce

Hi, I have a problem with the "Add to Cart" Button on a Single Product Page: When clicking the button, it keeps spinning forever and the cart is not updated asynchronously via JS. Console outputs the error: "Uncaught Reference Error: _ is not defined" (see Screenshot). When I refresh the page, the Cart has been updated successfully. The "Add to Cart" links on the Product Listings work fine. I've deactivated all plugins except for WooCommerce and the error is still there. What could be the problem?

BeTheme Version:

WooCommerce Version: 8.2.1

Wordpress Version: 6.3.2

PHP Version: 8.1.25


  • Hi,

    Please go to WooCommerce -> Settings -> Products, disable the AJAX option and check if the problem persists.

    Some WooCommerce extensions require a page reload to work correctly, which might cause it.

    Best regards

  • Hi, if I disable AJAX it works with a page reload. But it's supposed to work with AJAX as well, isn't it? It seems like betheme is missing/not including underscore.js, but calling it in woocommerce.js. I manually included underscore.js in the "header-shop.php" template and now it works with AJAX and without errors as expected.

  • I have passed it to the dev team, and you are right about the underscore.js.

    It will be added in the upcoming update.

    Best regards

  • Thanks, Phil! Best regards

Sign In or Register to comment.