Note: This is a X-Post from StackOverflow, I put it there before remembering this subexchange existed so apologies for the double-up.

My issue is surrounding the Add To Card method for configurable products and whether a configurable product via URL / querystring is possible.

The Magento Wiki has a resource for adding a product to cart via Query String for Magento < 1.3 HERE

This quotes a method using this example:


It also mentions that this was valid up to version 1.3.

I have been playing around with this in 1.7 and have noticed a Major difference in 1.7 is the encrypted key in the ->getAddUrl() method for the Form Action Attribtue so now the URLs look more like


With the product ID being the 35900.

If I use this URL in the browser it will direct me to the product page with a message saying Please specify the product's option(s).

I have been trying to pass the desired attribute options value in the URL to add the product to the cart with no success. (For the sake of saving space I'm omitting the URL up to and including the encrypted key) I've tried methods these to no avail:


My question is: Is it possible to add a configurable product via URL to the cart in Magento and if so, what is the format for passing the super_attribute id and Attribute Option Value?

  • can you please tell me what is [272] and 22... and how to get this
    – user2684
    Jul 16, 2013 at 17:09
  • 272 is the 'Super Attribute' which is found in the catalog_product_super_attribute tables. This is the ID for the attribute you're using. Example if you are a clothing store and EVERY item has a size attribute and that id is 272. Then every configurable item would need Super Attribute 272 assigned. The 22 is the ID of value of that super attribute. So if in your clothing store the size 'Medium' had an ID of 22 the query string would be super_attribute[272]=22 which really means super_attribute[size]=medium. Does this help?
    – James
    Jul 16, 2013 at 22:36

2 Answers 2


This has worked for me on CE (with sample data):


NOTE (this puzzles me a bit):
There is a difference between calling:




I mean the order of the super_attribute parameters is important. After calling the 2 URLs above I ended up with 2 cart lines of the same product with the same options. one looked like this:

Size Small Color Green

and the other was

Color Green Size Small

I guess if you add the products to cart via URL you should keep the order of the attributes as shown in the product view page for consistency.

  • Is there any option to avoid form key while calling this URL? Oct 31, 2017 at 7:30
  • @VIPINAROY I don't know.
    – Marius
    Oct 31, 2017 at 7:47

In latest magento versions we need to add form key also.


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.