Below are several examples you may find helpful.
- To add a single product to cart with a quantity of 1:
- To reset the cart before adding a single product with a quantity of 2:
- To add a single specific variant with a quantity of 5:
- You can also pass the parameters using normal querystring if your site is not configured with friendly URL:
- To add a single product and populate the custom fields (dynamic form), you need to pass the name & value pairs through the rvdsfdfr parameter. Suppose you created 2 custom fields for your product with the IDs "MyPrice" and "MyDesc".
You start by crafting your custom fields parameters as if it's a querystring:
Then you encode it and append it to the rvdsfdfr parameter so you end up with a URL like this:
- To add multiple products, you can chain a new URL using the returnurl parameter. You can chain as many URLs as you like (up to the limitation of your browser, usually 2000 characters). You must remember to encode the URL that you're chaining to so that any special characters don't conflict. If you're chaining multiple URLs, you need encode over the previously encoded URL (even if it's already encoded).