cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable ajax for add-to-cart button and wishlist button of product widgets on home page?

How to enable ajax for add-to-cart button and wishlist button of product widgets on home page?

I have added products on the homepage using the widget, how to enable ajax for add-to-cart button and wishlist button of product widgets.

1 REPLY 1

Re: How to enable ajax for add-to-cart button and wishlist button of product widgets on home page?

Hi @Aveeva,

 

You have to override addtocart.phtml file

app/design/frontend/vendorname/themename/Magento_Catalog/templates/product/view/addtocart.phtml

 

Now just replace "bindSubmit": false to "bindSubmit": true

<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "catalogAddToCart": {
                "bindSubmit": false
            }
        }
    }
</script>

to

<script type="text/x-magento-init">
    {
        "#product_addtocart_form": {
            "catalogAddToCart": {
                "bindSubmit": true
            }
        }
    }
</script>

Now delete cache and page_cache folder or flush cache.

 

Note: Make sure you have to set No from Store -> Configuration -> Sales -> Checkout-> Shopping Cart -> After Adding a Product Redirect to Shopping Cart to No.

 

Hope this can help you! Let me know if you need further assistance.

________
If issue solved, Click Kudos & Accept as Solution.

LitExtension - #1 Shopping Cart Migration Expert

LitExtension helps store owners and agencies migrate all important data from one eCommerce platform to another accurately, securely and at the highest speed.

Visit website: http://litextension.com/