0

I'm trying to add a product to my cart via query string based on the information on the Magento website.

I've tried the following:

  • /checkout/cart/add/product/3887/1/
  • /checkout/cart/add/product/3887/1/e8JDefUuLcGdLE1Q (Added Form Key)
  • /checkout/cart/add?product=3887&qty=1

The Product ID here is 3887 and it's a Simple product, with no special or custom options. I'm trying to send it through Ajax but it doesn't get put in the cart and then when I attempt to enter the URL directly I just get redirected to the homepage.

I'm getting the Product ID from a custom page where customers will be able to enter a list of SKU's into 10 input boxes (Quickshop page)

Thanks in advance!

SOLUTION for others:

URL must follow this:

/checkout/cart/add/product/PRODUCTID/qty/NUMBER/form_key/WSFiE69HmvU854G2 

1 Answer 1

3

The url for adding needs to include a form_key.

/checkout/cart/add/product/554/form_key/QOTCSV8HqoLA0K3T/
2
  • Ah, yes. I see I've forgotten form_key - I have the Key itself but no label! I'll try now Commented Jun 20, 2014 at 13:45
  • Update: I've also noticed I missed out /qty/ I now have: /checkout/cart/add/product/3887/qty/5/form_key/WSFiE69HmvU854G2 Works nicely! Commented Jun 20, 2014 at 13:59

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.