1

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 Dec 3 '19 at 6:43
0

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. – Manish Soni Dec 3 '19 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 Dec 4 '19 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.