Hey there, we noticed you didn't complete your Advanced Coupons purchase.

We're excited to have you join the Advanced Coupons family! Complete your checkout now & save!
If you have any questions, please reach out to our support team!

How To Create Add To Cart URLs In WooCommerce (2 Ways)

How To Create Add To Cart URLs In WooCommerce (2 Ways)

WooCommerce Add to Cart URLs can be found throughout your store. Whenever a customer interacts with an Add to Cart button, they are utilizing a URL generated by WooCommerce. This URL serves as a command for WooCommerce to include a particular product in the customer’s cart.

Moreover, you have the ability to manually generate these links!

In this article, we will discuss two easy ways to create a WooCommerce Add to Cart URL. Firstly, we will explore the manual approach, illustrating the inner workings of such URLs. Then, we will proceed to create one using Advanced Coupons. So, without further ado, let’s delve into the details!

What Are WooCommere Add to Cart URLs?

Usually, customers interact with Add to Cart URLs using buttons. When you click on a purchase button in a WooCommerce store, it uses an URL to tell the website to add a product to your cart. So, let’s inspect an Add to Cart button so you can see how that URL looks:

WooCommerce add to cart URL
WooCommerce add to cart URL (click to zoom)

The URL that you see in the bottom left is where WooCommerce “sends” you when you click on an Add to Cart button. WooCommerce uses a very specific format for those URLs, which means that you can easily create your own. Let’s find out how to do it.

How To Create A WooCommerce Add To Cart URL (2 Ways)

For this section, we’ll show you how to create WooCommerce Add to Cart URLs manually and using Advanced Coupons. Let’s start with the manual approach.

1. Create WooCommerce Add to Cart URLs manually

As you might have noticed, WooCommerce Add to Cart URLs follow a very specific structure. You have your site’s URL followed by ?add-to-cart=”PRODUCT ID”. Here’s a quick example:


We’re adding one single parameter to your store’s URL and indicating what product it should add to your customer’s cart. You can create WooCommerce Add to Cart URLs for any product on your store. All you need is that product’s unique ID.

To find a product’s ID, go to your dashboard. Then, head to the Products > All Products tab.

Subsequently, hover over the product that you want to create a custom URL for and you’ll see its ID showing next to the Edit option:

Displaying a product ID in WooCommerce
Displaying a product ID in WooCommerce (click to zoom)

Once you have the product ID, you can now create a WooCommerce Add to Cart URL for it.

Additionally, where to place that URL is up to you. However, traditionally, users prefer to click on buttons to add products to their carts. You can use that URL to add new buttons to your product pages besides the Add to Cart option that WooCommerce generates for you.

Similarly, with custom Add to Cart URLs, you can place buttons for your most popular products anywhere on your site, in places that WooCommerce traditionally doesn’t include those elements.

2. Generate an Add to Cart URL using Advanced Coupons

#1-rated coupon plugin in WooCommerce

Using Advanced Coupons, you can generate links that automatically add coupons when users click on them. Another one of Advanced Coupons’ features is that it enables you to create coupons that add specific products to customers’ carts. When you combine both features, you can create coupons that:

  1. Have links that enable users to click on them to apply the coupon
  2. Automatically add specific products to customer’s carts

If you want to create that type of coupon, go to Coupons > Add New. First, let’s generate a coupon code and enter a description for it:

Creating a WooCommerce add to cart coupon
Create or generate a coupon code (click to zoom)

Then, go to Coupon Data > General and choose what type of discount you want the coupon to offer. You can also proceed with setting up the coupon amount while you’re at it:

Select the discount type
Select the discount type (click to zoom)

Moreover, you can select the Fixed product discount option. That will apply a discount for specific products and we can configure the coupon to add those items to customer carts automatically.

To do that, go to the Add Products tab and select what products the coupon should add:

Configuring which products the coupon should add
Add products tab in Advanced Coupons (click to zoom)

You can configure your coupon to add as many products as you want to customer carts. At this stage, you already have a fully working coupon code. However, it’s still missing a URL that customers can use to apply it without entering the code manually.

Creating URL coupons in WooCommerce

Publish the coupon code and then go to Coupon data > URL Coupons. After you publish a coupon, Advanced Plugins will automatically generate an URL for it:

An example of a WooCommerce add to cart coupon URL
URL coupon example (click to zoom)

When users click on that URL, it’ll apply the coupon and add the products that you configured to their carts. By default, Advanced Coupons will redirect users to their cart. However, you can also change the Redirect to URL setting to send customers directly to the checkout page:

Configuring the coupon to redirect to the checkout page
Change URL redirection (click to zoom)

Your WooCommerce checkout page should be located at yourwebsite.com/checkout unless you changed it. By directing users to the checkout, you make it easier for them to complete their purchase.

Finally, now you can go ahead and share your WooCommerce Add to Cart URL coupon using social media, your email list, or just add it directly to your website.


WooCommerce makes it easy for customers to add products to their carts. And in this article, we shared 2 easy ways to create Add to Cart URLs in WooCommerce:

  1. Create WooCommerce Add to Cart URLs manually
  2. Generate an Add to Cart URL using Advanced Coupons

If you use Advanced Coupons, you can create coupons that add products to customer carts automatically. Each coupon gets its own URL, which you can place anywhere you want on your website. The advantage of this approach is that you can enable customers to add products to their carts and apply discounts with a single click.

Do you have any questions about how to create WooCommerce Add to Cart URLs? Let’s talk about them in the comments section below!

author avatar
Editorial Staff

Leave a Reply

Your email address will not be published. Required fields are marked *