Create a direct ‘Add to Cart’ link for Products in WooCommerce

Reading Time: 1 minute

If you run a blog and a store all on the same WordPress instance, chances are you are going to talk about products you sell in your blog posts. So how can you make it really easy for your visitors to add products you blog about directly to their cart? You can create a URL that you can use in your posts.

How can I create custom direct ‘Add to Cart’ links for products on my store?

To do this you need the product ID of the item you need a Add to Cart link created for.  You can find the ID for your products from the Products page of your WooCommerce web store. You can see the product ID listed here when you hover your mouse on the products row.

You’ll then need to create a url like the following:; where 123 is your product ID, keep in mind you’ll also need to use your domain name.

The most important part of this funtionality is that you’re adding the following query parameter to the URL: ?add-to-cart=123

Once you’ve got the link created you can use this on any of your websites pages! In fact these links can work from anywhere, even places not on your website. So, for example, you could create the link directly to your cart and share these to your partners and affiliates for placing quick item orders!

Author Bio

About the Author: Dan Pock

Dan Pock does Technical Writing & Marketing at Liquid Web with a background in System Administration, Public Relations, and Customer Service.

His favorite things include: his cats, Oscar Boots and Dash Nouget; experimenting with PHP; and making up recipes (or at least attempting to). You can find his coding hijinks on GitHub, where he shares most of his projects and open source work.

Get 25% off the first month on WooCommerce Hosting! Find out why 30,000 customers have chosen our Best-in-Class Performance & 24x7x365 Support