I have added custom add to cart submit button on product detail page.
On submit, i am getting other form fields values but not getting submit button name and value.
So how can i get the name or value of submit button in post.
Does anyone know how to solve it ? Thanks in advance.
-
please put your custom code.Chirag Parmar– Chirag Parmar2019年12月03日 06:43:47 +00:00Commented Dec 3, 2019 at 6:43
1 Answer 1
Override Js file in your theme and update the code that you want to update:
vendor/magento/module-catalog/view/frontend/web/js/catalog-add-to-cart.js
To
app/design/frontend/ThemeName/PackageName/Magento_Catalog/web/js/catalog-add-to-cart.js
-
Thanks for your response but i don't want to do with theme, I will override in module and try.Soni5041– Soni50412019年12月03日 10:33:46 +00:00Commented Dec 3, 2019 at 10:33
-
You can override with the custom module as below: In your app\code\Custom\Module\view\frontend\requirejs-config.js Add the following code. var config = { map: { '*': { 'Magento_Catalog/js/catalog-add-to-cart':'Custom_Module/js/catalog-add-to-cart', catalogAddToCart:'Custom_Module/js/catalog-add-to-cart' } } }; Put your add to cart file in app\code\Custom\Module\view\frontend\web\js path with name catalog-add-to-cart.js copy and past the parent file and Make your changes. Hope this will help.Madhu Rajawat– Madhu Rajawat2019年12月04日 11:21:57 +00:00Commented Dec 4, 2019 at 11:21