Get Started

How to Create a Custom Add-to-Cart Link in WooCommerce

Editorial Team
February 7, 2024
How to Create a Custom Add-to-Cart Link in WooCommerce

A WooCommerce add to cart link simplifies the shopping experience for customers by allowing them to add products to their cart with just a click.

It's an excellent way to promote products and offer exclusive deals and discounts with social media and email marketing campaigns.

Unfortunately, many WooCommerce store owners find it challenging to create custom add to cart links for their products, limiting their ability to promote the products effectively. 

It helps them provide a better user experience, ultimately attracting and retaining a number of your customers.

In this blog, we will share how you can add a custom add to cart link in WooCommerce that adds single or multiple products to the shopping cart with a single click.

Let’s begin. 

Default Add to Cart Options in WooCommerce

By default, WooCommerce offers an Add to Cart button on the product page, which users can click to add products to their cart. Add-to-cart buttons can also be found by default in the related product sections.

default add to cart link in WooCommerce add to cart woocommerce link

These add-to-cart options are great for any user who is already on the website and checking the product details to buy. But you can’t share these products with people with a link that takes them directly to the cart or checkout page

That’s where a custom link comes into play. 

Move to the next section to find more.

What is a Custom Add To Cart Link in WooCommerce?

A custom add-to-cart link in WooCommerce is a specially crafted URL that, when clicked, instantly adds one or more specific products to a user's shopping cart. This link is a convenient and efficient way to promote products, particularly in marketing campaigns, emails, or websites.

A add to cart WooCommerce link allows you to bypass the need for users to visit a product page and manually click the button. Instead, they can add items automatically to their cart with a single click on the custom link while they read about the product details.

Here is an example of a custom add to cart link in WooCommerce

https://www.yourdomain.com/?add-to-cart=ID

Here ID represents the the product ID. We will talk more about how to create custom add to cart link in detail later. 

Why You Should Utilize WooCommerce Add to Cart Link?

You should utilize add to cart link in WooCommerce for several compelling reasons:

  • Enhanced shopping experience: WooCommerce add to cart links streamline the purchasing process. It allows customers to swiftly add items to their cart with a single click, eliminating the need to navigate multiple product pages.
  • Effective sales promotion: These links serve as potent tools for promoting products, special offers, or discounts, significantly increasing the likelihood of conversion and boosting overall sales performance.
  • Ensure customer satisfaction: The simplified functionality of add-to-cart links elevates the user experience, fostering customer satisfaction and cultivating loyalty by reducing friction in the buying journey.
  • Improved conversion rates: By reducing the complexity of adding items to the cart, add-to-cart links contribute to heightened conversion rates, driving more successful transactions through a more efficient process.
  • Versatile marketing assets: These links can be strategically employed across various marketing channels, including emails, social media platforms, and websites, allowing businesses to engage customers by expanding their reach and impact.

We hope now you realize if used wisely, custom add to cart link can immensely benefit your business. 

How to Create a Custom Add-to-cart Link Without Any Plugin?

Here, we will show how you can create a custom add to cart link for different types of WooCommerce products and redirect to the cart or checkout page. This is quite easy to do and does not require any plugins.

Step 1: Find the product ID

Every product has its unique ID number, and we will need this to create a custom add to cart link. Where you find the product ID depends on your product type.

Find ID for simple products

To find ID for simple products, navigate to Products ⇒ All Products from the WordPress dashboard and hover over the product from which you want to create a link. You can find the ID here. 

how to find single product id in WooCOmmerce

Find ID for variable products

For variable products, you can collect the product ID, variation ID and all the attribute names with the values. 

You will find the variable product ID from Products ⇒ All products. 

copy variable product main ID

For the variation IDs, you can edit the Product, scroll down to the variations tab, and find the ID for all the variable products.

how to find variations id in WooCommerce

Find ID for Grouped Product 

With Grouped products, you need to collect the main group product ID, and since grouped products are a combination of other simple products, you also need to collect those simple product IDs.

Note: You can find the ID for grouped products the same way you can find it for simple products.

copy grouped product main Id

You can find the products that are included in the grouped products under the Linked Tab. 

find group product ids to create WooCOmmerce add to cart link

Once you have the necessary IDs, move to the next section. 

Step 2: Create a custom add to cart link

First, let’s understand the URL parameters we will use to create a custom add to cart link. Here are the parameters:

  • add-to-cart: WooCommerce uses this parameter to add the product to the cart using the product ID or Variation ID (in case of variable products).
  • quantity: This parameter specifies the quantity of the product that will be added to the cart.

Now, let’s check how you can use these parameters to create custom add to cart links. 

Custom add to cart link for Simple Products

To create the link, you need to append “add-to-cart=ID”  to your domain address. All you’ll need to do is replace the ID with the product ID you want to add to the cart upon clicking on the link we will create. 

Here is how the new URL will look:

https://www.yourdomain.com/?add-to-cart=ID

Example:

https://www.yourdomain.com/?add-to-cart=21

Note: if you don’t specify the product quantity, a single product will be added to the cart.

If you want to specify the quantity, you’ll need to append “&quantity=number” to the above URL.

Here is how WooCommerce adds to cart link with quantity will look like: 

https://www.yourdomain.com/?add-to-cart=ID&quantity=number

Example:

https://www.yourdomain.com/?add-to-cart=21&quantity=2

Custom Link for Variable Products 

For the add-to-cart parameter, you can either use the variable product ID or the ID of the variation. 

Using the main variable product ID

To create a link using product ID, you need to specify the attribute name with values and also add the variation ID.

For example, for a variable product ID 20 with a variation ID 46. If you want to create a link that will add a small size product in the color blue, your custom URL will be like this:

https://www.yourdomain.com/?add-to-cart=20&variation_id=46&attribute_pa_colour=blue&attribute_pa_size=s

To specify a quantity, append the “&quantity=number.” parameter. 

The above URL with quantity 3 will look like this.

https://www.yourdomain.com/checkout/?add-to-cart=20&variation_id=46&attribute_pa_colour=blue&attribute_pa_size=m&quantity=3

Using variation ID

To use a custom add-to-cart link for a variable product using variation ID, you just need to use the variation ID as the add-to-cart parameter. Since each variable product with a unique ID already has the attributes assigned to it, you don’t need to specify. 

So, if you want to create a custom link for a variable product with ID 20 that has a variation with ID 47, you can use this pattern:

https://www.yourdomain.com/?add-to-cart=ID

Again, to specify quantity, append “&quantity=number.” 

https://www.yourdomain.com/?add-to-cart=47&quantity=2

Note: While using the variation ID seems easier, the link with the product ID and specific attributes actually gives the user more information about the product, which can help with transparency. 

Custom Link for Grouped Product 

As mentioned earlier, for grouped products, you will need to know the Grouped Product ID and the IDs of the linked products. 

You must specify the quantity while creating a WooCommerce add to cart link for group products. 

Here is the URL format you need to use:

http://yourdomain.com/?add-to-cart=GroupProductID&quantity[SimpleProductID]=QuantityNumber&quantity[SimpleProductID]=QuantityNumber

Suppose a group product with ID 39 consists of two products: one with ID 15 and another with ID 16. 

Then, the group product add-to-cart link will be like this:

http://yourdomain.com/?add-to-cart=39&quantity[15]=1&quantity[16]=2

Hitting the URL above will add the group product with one piece of the first product with ID 15 and two pieces of the item with ID 16.

Step 3: Set the redirection page 

If you don’t specify the page, the user will be redirected to the home page after adding the product using the custom link. 

Since the product is added, the user should be redirected to the cart or checkout page. 

Let’s check out how you can redirect users to the cart/checkout page. 

Redirect to the cart page 

If you want to redirect users to the cart page after the product is successfully added, navigate to WooCommerce ⇒ Settings ⇒ Products and check the option “Redirect to the cart page after successful addition”. 

redirect to cart page using woocommerce add to cart link change add to cart link woocommerce

After checking the option, click on Save Changes to ensure your WooCommerce store will send users directly to the cart page after they add the product by clicking on the custom add to cart link. 

Now, let’s check how you can send them directly to the checkout page. 

Note: By skipping the cart page and sending users directly to the checkout page, you can ensure a better user experience, as it will save users time. However, if the users skip the cart page, they lose the ability to customize the order by updating the product quality. 

FunnelKit Slide-in mini Cart solves this issue by allowing users to check their order details and modify the items anywhere on the website without going to the cart page.  For more details, read our blog “How to skip cart page using a WooCommerce mini cart”.

Redirect to the checkout page 

To send the users directly to the checkout page, you need to ensure the option you checked to send users to the cart page is unchecked. 

So navigate to WooCommerce ⇒ Settings ⇒ Products. Now ensure to uncheck the option “ Redirect to the cart page after successful addition.” Click on Save Changes to update. 

uncheck and send to checkout change add to cart link woocommerce

After that, you also need to make some changes to the add to cart link. You need to add “/checkout” after your domain and before the add-to-cart parameter.

So it would look something like this.

https://example.com/checkout/?add-to-cart=21

With quantity 

https://example.com/checkout/?add-to-cart=21&quantity=1

For variable product 

https://www.yourdomain.com/checkout/?add-to-cart=20&variation_id=46&attribute_pa_colour=blue&attribute_pa_size=m&quantity=3

For group product 

https://www.yourdomain.com/checkout/?add-to-cart=39&quantity[15]=1&quantity[16]=2

If you want, you can redirect to any page you want, not just the cart and checkout page. For that, you need to follow the steps you would for the checkout page just replace “/checkout” with “/your_custom_page/”. 

For example, if you want users to redirect to a page named “custom” your URL will look like this:

https://www.yourdomain.com/custom/?add-to-cart=21

This is how easily you can create a WooCommerce add to cart link. However, this process only adds one product to the cart. Later in this blog, we will show you how to add multiple products to a cart with a single custom add to cart link.

Troubleshooting Common Issues

Sometimes, the Add to Cart link may not work due to some reasons like 

  • Wrong cart or checkout page link
  • A theme or plugin conflict
  • Memory issues

The first thing you should check and make sure that you have linked the cart page or checkout page properly.

After checking this, you need to inspect if there is a theme of plugin conflict. You should disable all the plugins other than WooCommerce to see if the issue is solved; if yes, then you know there is some conflict in the theme or plugin. 

Ensure all the plugins you use are compatible with your current version of WordPress and WooCommerce. Sometimes, plugins that haven’t been tested with the latest version of WordPress can throw issues. 

In case of theme conflict, switch to a different default WordPress theme.

WordPress plugin not tested

In case of a memory issue, contact your hosting provider to increase the memory to solve this issue.  

While you can solve the issue when using a custom WooCommerce add to cart link, it’s not the most efficient way as you can’t create a link for multiple products. 

A custom add to cart link that will add multiple products will help you promote many products simultaneously. 

Move to the next section to find out how to create a custom link using a sales funnel that will add multiple products to the cart and redirect the user to the checkout page with a single click.

How Do You Create a WooCommerce Add to Cart Link that Adds Multiple Products to the Cart with a Single Click?

To create WooCommerce add to cart link that will add multiple products to the cart with a single click, we use FunnelKit Funnel Builder. 

This is the most potent funnel builder for WordPress that allows you to create beautiful sales funnels with landing pages, opt-in pages, checkout pages, thank you pages, one-click upsells, and so on, without requiring any coding knowledge. 

FunnelKit has many prebuilt templates that you can easily import and use within a few clicks.

Depending on your requirements, you can create a custom link via a sales funnel for a single product or multiple products. Here, we will show how you can create a sales funnel that adds multiple products to a cart and use the funnel link as a WooCommerce add to cart link. 

Before we start the process of creating a WooCommerce one click upsell funnel, let’s install and activate the FunnelKit Funnel Builder. 

FunnelKit has two versions: Free and Pro. You need to install both the plugins.

Step 1: Create a sales funnel 

First, navigate to FunnelKit ⇒ Funnels from the WordPress admin panel and click the ‘Create New Funnel’ button.

add new funnel

Now choose “sales funnels” as the type and choose your favorite page builder. FunnelKit is compatible with all the popular page builders, such as Elementor, Divi, Gutenberg, Oxygen, etc.

After that, hover over the template you like and click on Preview. Here, we are choosing the Minimalist template.

minimalist template click on preview

Now, choose whether you want a single-page checkout or a multi-page checkout. We are going with the simple single-page layout.  

To import the template you choose, click “Import this funnel,” then provide a name and click Add.

import minimalist for add to cart link funnel

Now your sales funnel with two steps - checkout and thank you page should be imported. 

Step 2: Customize the checkout page

To customize the checkout page click on the Checkout step.

click on edit checkout

You can customize the content and style of the checkout template using Elementor by clicking on the "Edit Elementor Template".

edit minimalist checkout template one step

Here, you can customize all the sections of the checkout page.

customize order informations

One of the useful features that FunnelKit offers on the checkout page is the WooCommerce mini cart. This feature allows users to modify the product quantity on the checkout page without going back to the cart page. 
So, if you want to send your user directly to the checkout page, skipping the cart page and not worry about not giving the user enough control over their purchase decision, then you should definitely ensure your checkout page has this mini cart by FunnelKit.

mini cart customizations

After making the design changes, hit Update to save all the changes. 

Note: Another great way of skipping the cart is to use a slide in the Shopping cart on your WooCommerce store. With a slide-in cart, customers can access the order at any time without going to the cart and can go directly to the checkout page by clicking on a button.

For more details, check our blog “How to Customize WooCommerce Checkout Page”.

Step 3: Add multiple products to the checkout page

Now move to the Products tab and click on the “Add Product” button. Then, search and select the product you want to be added to the cart upon clicking on the WooCommerce add to cart link.

Add as many products as you need using the same process. Finally, click on “Add New” to add the product to the checkout. 

add multiple products to checkout for add to cart link

You can offer discounts on the products. 

add discount to multiple products

Scroll down to the settings section choose the option “Force sell all of the above product(s)” and click on Save changes to update.

force users to add all products to cart

Step 4: Optimize the checkout page 

Come back to the Design tab and scroll to the "Checkout Form Fields" section. Here, you can rearrange or customize the form fields. For more details, check this blog, “WooCommerce Checkout Field Editor.” If you want you can also add any custom field to the checkout page.

customize checkout form fields

On the optimization tab, you can add express checkout like Apple and Google Pay, Google Address autocomplete, auto-apply coupon, etc. These will ensure your user experiences a frictionless checkout process.

 For more details, you can read our blog on checkout page optimization.

WooCommerce checkout page customizations tab

Note: You can even offer an order bump on the checkout page to increase the average order value.

After customizing the checkout page, you can customize the thank you page as well. If you need help, check out the blog “How to Create Custom WooCommerce Thank You Pages”.

Step 5: Test the WooCommerce add to cart link 

To get the WooCommerce add to cart link with products you added to the checkout, click on the Preview option of the checkout page.

click to preview add to cart link multiple product

This will open the link on a new tab. 

WooCommerce add to cart link multiple products review

Now you can copy this WooCommerce add to cart link and use it for any promotional campaign. Whenever the user clicks on the link, the products you added to the checkout will automatically be added to the cart, and they will be redirected to the checkout page. 

Ready to Use WooCommerce Add to Cart Link?

The WooCommerce add to cart link is a valuable feature that can boost your sales by offering a seamless way for customers to add products to their cart with just a single click. 

It's a user-friendly solution that make customer interaction more effective with your products during promotional campaigns. 

Now you know how to create WooCommerce add-to-cart links that add single or multiple products to a cart with a single click.

With FunnelKit Funnel Builder, you can offer users an effective way of shopping by allowing them to update the product quantity on the checkout page. 

Moreover, you can use the sales funnel builder to offer order bumps, upsell, and downsell to improve the average order value. 

So, don’t waste time. Start using FunnelKit to create a WooCommerce add to cart link today. 

Author: Editorial Team
The Editorial Team at FunnelKit (formerly WooFunnels) is a passionate group of writers and copy editors. We create well-researched posts on topics such as WordPress automation, sales funnels, online course creation, and more. We aim to deliver content that is interesting and actionable.
chevron-down