I am trying to add products with custom options in cart via query string but it does not worked.

//my redirecting on click here
<?php echo "http://localhost/magento_bnsb_guide/index.php/checkout/cart/add/product/".$_product->getId()."?qty=2&options[3]=1"; ?>')">

i copied this url from source.


  • how or where to get form key? Commented Sep 9, 2015 at 12:27

2 Answers 2


If you are using Magento version greater 1.7.x.x you need to add form key with URL


You're missing the uenc or security code to go with that. Try using

$product = Mage::getModel('catalog/product')->load($this->getProduct());
echo Mage::helper('checkout/cart')->getAddUrl($product);
  • how to attach query string with it Commented Sep 9, 2015 at 12:13
  • How would you add a simple product (size option of configurable product)? - same as selecting a T-shirt in size SMALL on the product page ... but then for getAddUrl? thx
    – snh_nl
    Commented Nov 9, 2018 at 18:27

Your Answer

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

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