There is a strange issue with my website. My Add to cart is not working on Iphone. Its working fine on all other devices.

I think the session is getting destroyed while browsing to next page. I tried different settings on iphone but none works.

I have tried few methods like in add to cart one of the post suggested to make add to cart button from type=button to type=submit but it didn't worked.

Can anyone please guide me through this.


  • Can you give the url of the website? – Evrijn Oct 28 '14 at 7:28

You're missing the form key. This can have several causes, most notably a class is overriding Checkout/Helper/Cart.php and doesn't have form_key code in getAddUrl(). Known offender from my end: MW/Ajaxcart extension.

If this isn't the cause, please answer the following:

  1. Are you using the mobile/iphone template shipped with Magento and has it been upgraded to 1.8 or are you using a copy?
  2. Do you have the file app/design/frontend/base/default/template/core/formkey.phtml?
  3. If you have the file, does it get called (just stick a JS alert in it)?
| improve this answer | |
  • No there is no overridding of Cart.php and also its has form_key. I am using ULTIMO THEME from themeforest. There is also a formkey.phtml present and also it is being called. I dont know what can be the reason. – Dexter Apr 7 '14 at 4:21

I had the same problem in V1.7.0.0 on the iPhone theme, to solve it I created a new link instead of the button with the add to cart URL as the href and then added the product id programmatically to the end of it, then styled it to look like the original button.

So I replaced this line:

<button type="submit" title="<?php echo $buttonTitle ?>" class="button btn-cart" onclick="productAddToCartForm.submit(this)"><span><span><?php echo $buttonTitle ?></span></span></button>

with this and it works fine:

<a href="<? echo Mage::getUrl('',array('_secure'=>true)); ?>checkout/cart/add/product/<?php echo $_product->getId() ?>"  title="<?php echo $buttonTitle ?>" class="my_button btn-cart" >Add to Cart</a>

Im sure there maybe some issues if you have configurable products

| improve this answer | |

please try <a href="" ontouchstart="add to cart action">Add to cart</a>. I hope its working...

| improve this answer | |
  • No its not working... i dont know whats the problem is.. once i add to cart and when it redirects to next page it says shopping cart empty – Dexter Apr 5 '14 at 8:48

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.