I am trying to add a product from a custom page to the cart. I have the Configurable and also simple and I have the values of the options and also the IDs of the options.

I tried to use:


in the way


Did not work out .

Then I tried this :


This also did not work out. What Am I missing?

Any help will be appretiated.


  • you can not add custom options of product at cart level
    – Keyul Shah
    Commented Sep 25, 2014 at 16:59
  • What error msg are you getting? Commented Sep 25, 2014 at 17:09
  • I am not adding Custom options. Thear are attribute options from Dropdowns. It says all the options are not sent to add the product, so an option is missing, it redirects me to the product page and tells me to select all options needed. They are only two and I am sending both of the,. When I sent it with the Simple product ID I got an other error , getProduct() function on a null object. So Two cases, two different Errors.
    – CntkCtn
    Commented Sep 26, 2014 at 8:03

3 Answers 3


Assuming that you are using magento v1.7.*, then to add simple product with more than 1 option to Cart try

$product_id = 165;

$option_id1 = 424;
$option_val1 = 6699;

$option_id2 = 433;
$option_val2 = 6830;



To get the above values go to your product page and look up the values... eg.

<select name="options[424]" id="select_424" class=" required-entry product-custom-option front-finishes" title="" onchange="opConfig.reloadPrice()">
  <option value="">-- Please Select --</option>
  <option value="6698">Red</option>
  <option value="6699">Green</option>

If your still having issue then double check if you have any third party module that extend your cart functionality.

Adding a Configurable Product to the Cart via Querystring

For adding a Configurable Product to the Cart via Querystring you need a url format like following


See Adding a Product to the Cart via Querystring

  • Just one clearence on the issue, The Product Id is from Configurable or from Simple ?
    – CntkCtn
    Commented Sep 26, 2014 at 8:00
  • Simple product, to add configurable .../checkout/cart/add?product=68&qty=1&super_attribute[528]=55&super_attribute[525]=56 Commented Sep 26, 2014 at 12:31
  • A bit late my Friend. I already solved my problem. Thanks anyway.
    – CntkCtn
    Commented Sep 26, 2014 at 14:38


There are issue with form key in both all of case you need .in magento cartController.php at addAction magento us checked form key using _validateFormKey() function.if it validate then product is not added in cart

If you want add a product in cart then you need to create proper product cart url using below function

  • Does 'form key' validation affect v1.7.*? Commented Sep 25, 2014 at 17:15
  • no..magento 1.7 do not check form key
    – Amit Bera
    Commented Sep 25, 2014 at 17:18
  • What are the values or what is the build up of $parameter=array() in this function? We want to add 1 child product of a configurable parent product
    – snh_nl
    Commented Nov 8, 2018 at 14:14

I looked at the Add to Cart network calls and I saw that it is not options but super_attribute.

Last code I used is :

            <a href="<?php echo Mage::getBaseUrl() ?>checkout/cart/add?product=<?php echo $product->getEntityId(); ?>&qty=1&super_attribute[145]=<?php echo $realSimple->getData("liegeflaeche") ?>&super_attribute[146]=<?php echo $realSimple->getData("haertegrad") ?>">
                <img src="" alt="product5" />ADD TO CART

And it works like hell.


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.