I am new to the Magento, so not sure how we can implement this I want to send ajax request on Add to cart button on product detail page where I have to send the request to get stock from third party API.
-
product detail page– Daniel_12Commented May 11, 2018 at 12:24
-
@Daniel_12 check magento.stackexchange.com/questions/125681/…– Nikunj VadariyaCommented May 11, 2018 at 12:27
-
magento version 2.2.0– Daniel_12Commented May 11, 2018 at 12:31
-
I know its default but i need to check stock in my third party api– Daniel_12Commented May 11, 2018 at 12:39
-
@SureshChikani sure :) I will be take care of this thing in future but as of now do you know how can I implement this– Daniel_12Commented May 11, 2018 at 12:51
|
Show 1 more comment
1 Answer
You need to override file:-
app/design/frontend/[vendorname]/[themename]/Magento_Catalog/templates/product/view/addtocart.phtml
Replace "bindSubmit": false To "bindSubmit": true
<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"catalogAddToCart": {
"bindSubmit": true
}
}
}
</script>