Skip to content
Advertisement

Magento Add to Cart not working

“add to cart” is not working in my Magento Mobile version. Its build up of Jquery-Mobile.

Javascript console says

Uncaught TypeError: Cannot call method ‘submit’ of undefined

I searched the code for a long time but couldnt find out the error. I am a little bit new to magento and Jquery- mobile versions. Please help. I will share my codes below.

app/design/frontend/mobile/template/catalog/product/view.phtml

JavaScript

app/design/frontend/mobile/template/catalog/product/view/addtocart.phtml

JavaScript

as you can see i have given an alert inside the javascript submit function. But it is not showing up.

Advertisement

Answer

Try console.log(productAddToCartForm) right after this line:

JavaScript

What is the output ? Make sure the file containing those VarienForm js classes is actually loaded in the page. Basically check the console for any potential missing JS libraries, if you havent modified anything thats possibly the reason…

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement