How to use Ajax add to cart option in Magento2

How to use Ajax add to cart option in Magento2 – Product list page:
Ajax add to cart option by default magento2 luma theme is providing. Below is the script when you add on list.php we can achieve the add to cart option. When you override or creating your own theme we might miss the below script, due to missing of this code we can’t reach ajax add to cart option. Always use below script when your override or creating a new theme file in magent2.

List page ajax add to cart:

{
“[data-role=tocart-form], .form.map.checkout”: {
“catalogAddToCart”: {}
}
}

Leave a Reply