I am looking to build links from another system that will take the user to the StoreFront shopping cart with the selected item(s).


I am looking at the following link:


and I was wondering if there is a way to create a link that I can send product ids instead of the page names.



in MultiStore by (155 points)

3 Answers

0 votes
You need to pass the product, variant and quantity to the cart


We used something like this on an xml package last year


onclick="psaddtocart(52464,53390,1)" href="#">


The first two numbers being product and varitant ID the last being the quantity added to the cart. This should be a guide to start with
by (2.3k points)
Thanks for the response but my what I need is to comeup with a way to add an item to the StoreFront shopping cart from another website.

I was thinking that the method to do so is to do an HTTP POST to StoreFront with the desired item(s) and then route the user to StoreFront for payment whenever they finish selecting products.  

My question really is:

1. Can use such a mechanismun?

2. If so, how do I build the URI Post?  What is the syntax?

3. Is there a better method?


+1 vote
We did this on an integration project for one of our add-ons.  The minimum info needed is VariantID.  You can see an example (no source code needed - it's in the website) in the code-behind for addtocart.aspx.cs (or .vb).  Look toward the end of the Page_Load event and you'll see a sample QueryString type value that is a good starting point, but you'll also see how this page handles empty values.

You should probably consider color and size attributes unless your store does not need them.

BTW, you can post a querystring request to this page and it will add an item to your cart.  Note that this page is specifically designed for that purpose.
by (1.8k points)
edited by
Something like this




you could add a return url at the end if you want to take them to the homepage but this should default to shoppingcart.aspx
Skriver is right, addtocart.aspx is one of those hidden gem pages that can be really useful - particularly if you want to auto-add items to the cart using Ajax and/or JQuery.

addtocart.aspx also supports other parameters such as Color and Size.
This is giving me an error, I am new to the store.

 <a href="/addtocart.aspx?Quantity=1&productid=12345&VariantID=6789">test</a>


both productid and variantid are undefined which makes no sense since they are just a reference name.  This is inside a XML, could that be the issue
These would need to be real a Product and Variant ID combination that exists in your store.
0 votes

As you have written: "I am looking to build links from another system that will take the user to the StoreFront shopping cart with the selected item(s).", So, if you wish to select multiple items and get those added in a single click from another website, then you need to write an Ajax or javascript which repeatedly calls addtocart.aspx with relevant VariantId and other optional parameters.

by (680 points)