Adding Products to Cart via URL
page last edited on 27 March 2015
Imagine the following situation: A friend of yours wants to write a blog post about your product, and you want to provide them with a special link to include into this blog post that will help potential buyers to easily buy the product in question from your store. The link should be crafted in such a way that, when a customer clicks on it, they will be redirected to your store where they will find the product already added to the shopping cart.
You can easily create the link in question using the following format:
http://<your-domain>/<x-cart-5-directory> will, of course, need to be replaced with the actual address of your store, and the part “[YOUR-PRODUCT-ID]” - with the product ID of the product you wish to market via this sales channel. The product ID can be easily obtained via the store’s Admin area. Just open the product you require and look at the browser address bar; it will look something like this:
In the example URL above, 12345 is the product ID. Copy and paste it into your hand-crafted link.
For products with variants it’s recommended to use the Buy Button addon to generate a link on a particular product variant to be added to cart.
Help make this document better
This guide, as well as the rest of our docs, are open-source and available on GitHub.