Why Magento 2 Adds Configurable Products to the Cart Twice

Why Magento 2 Adds Configurable Products to the Cart Twice

On some Magento 2.2 stores, adding a configurable product to the cart sends two AJAX requests, so the mini cart shows double quantities. We traced it to the Amazon Pay module’s add-to-cart script binding a second submit handler.

Option 1: disable the Amazon modules

If you do not use Amazon Pay or Login with Amazon:

php bin/magento module:disable Amazon_Core Amazon_Login Amazon_Payment

Option 2: remove the duplicate submit

If you need the module, comment out these lines in vendor/amzn/amazon-pay-and-login-magento-2-module/src/Payment/view/frontend/web/js/catalog-add-to-cart.js:

self.submitForm($(this));
this._bindSubmit();

Editing vendor files is a stopgap. Override the file in your theme or upgrade to a fixed module version as soon as you can.

Want this done for you? Find out more about our Magento development service.

Keep reading

Related articles

All articles

Need a hand?

Stuck on something similar?
We can fix it with you.

Send us the problem. A senior developer reads every message and replies within one working day.