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.

asked Dec 3, 2019 at 6:39
1
  • please put your custom code. Commented Dec 3, 2019 at 6:43

1 Answer 1

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

answered Dec 3, 2019 at 7:13
2
  • Thanks for your response but i don't want to do with theme, I will override in module and try. Commented 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. Commented Dec 4, 2019 at 11:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.