How to disable Ajax Add to Cart on Product page in Magento 2

How to disable Ajax Add to Cart on Product page in Magento 2

The shopping cart is like a bridge between shoppers & sellers that enables the customer to check out the product that they are willing to purchase. That’s why it is an extremely important factor in delivering a great shopping experience to store customers. But sometimes store customer takes more time to check out the product once they added products to the cart by searching for more options and thinking over and over. At that time, quickly redirecting store customer to cart page and enforcing customer them to check out a product with drastically helps you to boost store conversions in no time.

Recently, one of our customers was worrying that even after he is getting tons of visitors he is not able to get a respective conversion that he should have. After researching and analyzing problems, we have listed some of the solutions and we tried, and this one has helped a lot by improving store conversion up to 5 to 10%. That’s why we decided to share this on our MageComp blog, to disable Ajax ‘Add to Cart’ option on a Product page of Magento 2.

Follow these 3 steps guide to disable Ajax ‘add to cart’ button and redirect your store customer to cart page once they add any product to their shopping cart.

Step-1: Open this file ‘addtocart.phtml’ file available on below location.
vendor\magento\module-catalog\view\frontend\templates\product\view\addtocart.phtml

Step-2: Now look for the below code available around line no-44 inside file.


And replace that code with given code.


NOTE: We always advised you not to make changes in core files, instead you can override this file by creating custom extension.

Step-3: Lastly navigate to backend admin dashboard and make following change in configuration.
Store->Configuration->Sales->Checkout->Shopping Cart->After Adding a Product Redirect to Shopping Cart to Yes.

Tadda, you have successfully implemented solution in your Magento 2 store. Now whenever your customer add products to frontend shopping cart extension will automatically redirect them to cart page.

Lastly, Comment down below if you face any issue while using this code.
Happy Redirecting!

Previous Article

How to Fix programmatically mini cart not updated issue in Magento 2

Next Article

How to change currency symbol position left to right in Magento 2

Write a Comment
  1. When I try to disable ajax add to cart on Product page in Magento 2.Then it shows “Uncaught ReferenceError: Unable to process binding “if: function(){return displaySubtotal() }” in firebug console

Leave a Comment

Your email address will not be published. Required fields are marked *

Get Connect With Us

Subscribe to our email newsletter to get the latest posts delivered right to your email.
Pure inspiration, zero spam ✨