All Collections
Marketing
Business Promotion
Adding Products to Cart via URL
Adding Products to Cart via URL

Learn how to build direct URLs for product ordering that can be used outside X-Cart.

Olga Tereshina avatar
Written by Olga Tereshina
Updated over a week ago

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 link to include in this blog post. This link will help potential buyers buy the product in question from your store. It should be crafted to redirect to your store upon a click. There 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>/cart.php?target=cart&action=add&product_id=[YOUR-PRODUCT-ID]

You will need to replace the http://<your-domain>/<x-cart-5-directory> part with the address of your store and the [YOUR-PRODUCT-ID] one - with the ID of the product you wish to market via this sales channel. You can quickly obtain the product ID in the store’s Admin area. Just open the product you require and look at the browser address bar; it will look something like this:

http://<your-domain>/<x-cart-5-directory>/admin.php?target=product&product_id=12345

In the example URL above, 12345 is the product ID. Please copy and paste it into your hand-crafted link.


For products with variants, it’s recommended to use the Buy Button add-on to generate a link on a particular product variant to be added to the cart.


Related pages:

Did this answer your question?