Check-out our new look and give us some feedback!

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

Posted on by Dan Pock | Updated:
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 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 an 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.

product ID

You’ll then need to create an url like the following: https://www.yourwebsite.com/?add-to-cart=123; where 123 is your product ID, keep in mind you’ll also need to use your domain name.

The most important part of this functionality 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!

About the Author: Dan Pock

Dan Pock does technical support at Liquid Web with a background in System Administration, Public Relations, and Customer Service. His favorite things include his cats, Oscar Boots, and Dash Nougat; 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.

Latest Articles

How to Edit Your DNS Hosts File

Read Article

How to Edit Your DNS Hosts File

Read Article

Microsoft Exchange Server Security Update

Read Article

How to Monitor Your Server in WHM

Read Article

How to Monitor Your Server in WHM

Read Article