Skip to content
logo
  • Company
    Company
    • About Us
    • Testimonials
    • Infrastructure
    • Culture & Values
    • Career
    • Life At BrainSpate
  • Technology
    Technology
    • WooCommerce
    • Shopify
    • Magento
    • Salesforce
  • Hire eCommerce
    Hire eCommerce
    • Hire WooCommerce Developers
    • Hire Shopify Developers
    • Hire Magento Developers
  • eCommerce
    eCommerce
    • eCommerce Development
    • eCommerce Marketplace
    • eCommerce Website Design
    • eCommerce Website Packages
    • eCommerce Management
    • eCommerce Consultant
    • B2B eCommerce
    • B2C eCommerce
    • Headless Commerce
    • eCommerce Maintenance
    • eCommerce Implementation
    • eCommerce Migration
  • Portfolio
  • Blog
  • Contact Us

How to Create an Add to Cart URL in WooCommerce?

Quick Summary

  • WooCommerce Add to Cart URLs let users add products to the cart directly via custom links.
  • You can customize these URLs for simple, variable, and grouped products with quantity and redirection options.
  • Implementation is possible through manual links, plugins, or developer-friendly PHP snippets.
  • Best practices, hidden features, and troubleshooting tips help ensure smooth functionality and better user experience.
publisher
Ankur Shah
|May 26, 2025
9 min read
How to Create an Add to Cart URL in WooCommerce?
Table Of Contents
  • How to Create Add to Cart URLs in WooCommerce?
  • Optimization & Troubleshooting Tips
  • FAQs for Creating an Add to Cart Url in Woocommerce
  • Let’s Summarize

Ever wish buyers could skip steps and go straight to checkout? With add to cart URLs in WooCommerce, they can. Just one click, and the product is already in the cart.

It’s a quick way to boost sales and make shopping easier. You can use these links in emails, social posts, or landing pages.

Many experienced WooCommerce website developers recommend using add to cart URLs to make the shopping process smoother. In this blog, we’ll walk you through how to create and use these links in a simple and clear way.

How to Create Add to Cart URLs in WooCommerce?

Creating an add to cart URL in WooCommerce lets you control the entire cart experience with just a link. You can add a product, set the quantity, or even decide where the user goes next — cart, checkout, or a custom page.

It works great for email campaigns, landing pages, and social media promos where fewer clicks mean more conversions. Let’s break down how to create these URLs based on the type of product and the result you want.

ATC URL for Simple Products

Use this for products that don’t have any variations (like size or color). You just need the Product ID, which you can find in the WordPress admin under Products > All Products. Hover over the product name, and you’ll see the ID.

Format:

https://yourstore.com/?add-to-cart=PRODUCT_ID

Example:

https://yourstore.com/?add-to-cart=101

This adds one unit of the product with ID 101 directly to the cart. This is perfect for quick-buy buttons on landing pages or blog posts.

Find Your Shade

ATC URL with Quantity Parameter

Want to let users add more than one unit of the same product? Just use the quantity parameter in the URL.

Format:

https://yourstore.com/?add-to-cart=PRODUCT_ID&quantity=QUANTITY

Example:

https://yourstore.com/?add-to-cart=101&quantity=3

This adds three units of product ID 101 to the cart. It is useful for B2B stores or bulk order promos — one click and multiple items are added.

Find Your Shade Cart

ATC URL for Variable Products

Variable products have options like size, color, etc. For these, you need the Variation ID, not the parent product ID. You can find this in the Products > Product > Variations tab.

woocommerce dashboard

Format:

https://yourstore.com/?add-to-cart=VARIATION_ID&quantity=QUANTITY

Example:

https://yourstore.com/?add-to-cart=203&quantity=2

This adds two units of the selected variation (like Large, Blue) with ID 203. Always make sure the variation is active and in stock, or the URL won’t work.

Cart for your shade

You can find variation IDs in the product data under Products → Variations in WooCommerce admin.

ATC URL for Grouped Products

Grouped products are collections of simple products sold together but added individually. You can specify quantities for each child product in one URL.

Format:

https://yourstore.com/?add-to-cart=GROUPED_ID&quantity[CHILD_ID1]=X&quantity[CHILD_ID2]=Y

Example:

https://yourstore.com/?add-to-cart=3111&quantity[1803]=2&quantity[1804]=1

This adds two units of product 1803 and 1 unit of 1804 — both part of the grouped product ID 3111. It is great for product bundles or starter kits where users can pick quantities of each item.

Redirect to Cart After Adding to Cart

Want users to land directly on the cart page after clicking the link? Just change the base URL to /cart/.

Format:

https://yourstore.com/cart/?add-to-cart=PRODUCT_ID&quantity=QUANTITY

Example:

https://yourstore.com/cart/?add-to-cart=101&quantity=1
Price Cart

It is best when you want users to review their order before moving to checkout.

Redirect to Checkout After Adding to Cart

You can skip the cart step and take users straight to checkout. Change the base URL to /checkout/.

Format:

https://yourstore.com/checkout/?add-to-cart=PRODUCT_ID&quantity=QUANTITY

Example:

https://yourstore.com/checkout/?add-to-cart=101&quantity=1
Protective

This works well for flash sales, limited-time offers, or one-product stores.

Want Custom Add to Cart Buttons That Convert?
Talk to Our Team

Redirect to a Custom Page After Adding to the Cart

Want to send users to a thank-you page or a special offer after the product is added? Just change the base URL to your custom page’s URL.

Format:

https://yourstore.com/custom-page/?add-to-cart=PRODUCT_ID&quantity=QUANTITY

Example:

https://yourstore.com/thank-you/?add-to-cart=101&quantity=1

This works great for funnels — add the product, then show a thank-you message or upsell.

Add Multiple Products at Once (Grouped via Quantity Array)

By default, WooCommerce doesn’t support adding multiple unrelated products in one link. But with grouped products or bundles, you can add multiple child products using a quantity array.

Example:

https://yourstore.com/?add-to-cart=GROUPED_ID&quantity[1803]=1&quantity[1804]=3

This adds both child products — 1 unit of 1803 and 3 units of 1804 — under the grouped product 3111. If you want to add unrelated products together (not grouped), you’ll need a plugin or custom code snippet.

Add to Cart URL Cheatsheet (Quick Copy Section)

Here’s a quick reference table you can copy and use:

Use CaseURL Example
Simple Product (Qty 1)/?add-to-cart=101
Simple Product (Qty 3)/?add-to-cart=101&quantity=3
Variation Product/?add-to-cart=203&quantity=2
Grouped Product/?add-to-cart=3111&quantity[1803]=2&quantity[1804]=1
Redirect to Cart/cart/?add-to-cart=101&quantity=1
Redirect to Checkout/checkout/?add-to-cart=101&quantity=1
Redirect to Custom Page/thank-you/?add-to-cart=101&quantity=1

These simple URL tricks can make a big difference in how users shop on your site. You’re giving them fewer clicks, a faster path, and a smoother buying experience. Whether you’re a store owner, marketer, or developer, these small tweaks add up to better conversions and easier workflows.

Optimization & Troubleshooting Tips

Add to Cart URLs are powerful tools, but like anything in WooCommerce, they work best when set up properly. Whether you’re using them in campaigns or landing pages, a few small tweaks can make a big difference.

This section covers smart practices, useful features, and how to fix common issues if something goes wrong.

Best Practices for Add to Cart URLs

These small but important tips help your ATC URLs work smoothly across different devices and platforms.

Start by using the correct product or variation ID. Simple products use their main product ID, while variable products need the variation ID. You can find both in your WooCommerce dashboard under Products → Variations.

Use the quantity parameter only when you need more than one item added. For example, & quantity=3 works, but if you skip it, WooCommerce will add just one by default. No need to overcomplicate it.

Test your URLs before making them live. Open them in incognito mode or another browser to see if the correct product is added, the quantity updates, and the redirect (if any) works.

Keep your URLs clean and user-friendly, especially when sharing on social media, email, or QR codes. Long or confusing links might look suspicious or overwhelm the user. If the URL gets too long, consider using a reliable URL shortener — but always test after shortening.

Troubleshooting Common Issues

Even with the right format, things can break. Here’s how to handle common issues without getting stuck.

Problem: Product not added to cart

  • Double-check that the product or variation ID is correct.
  • Make sure the product is published, in stock, and purchasable.
  • If you’re using a caching plugin, clear your site cache. Some caching tools block dynamic URL behavior.

Problem: Quantity doesn’t update

  • For simple products, use &quantity=2 (or any number).
  • For grouped products, format it like this: quantity[1803]=2. The structure matters — missing brackets will break it.

Problem: Redirect is not working

  • Confirm that the redirect URL exists and loads properly.
  • Check your WooCommerce permalink settings. Custom structures or redirects from plugins can mess things up.
  • If nothing helps, try disabling plugins related to redirection or cart behavior, then test again.

Sometimes, conflicts come from custom code or third-party tools. Isolating the issue by testing on a basic setup (default theme, core plugins only) can help figure out what’s interfering.

FAQs for Creating an Add to Cart Url in Woocommerce

How to change add to cart button URL in WooCommerce?

To change the add to cart button URL in WooCommerce, you can use a custom link instead of the default one. To do this, create a custom Add to Cart URL (like /?add-to-cart=PRODUCT_ID) and link it to any button or anchor tag manually. If you want to change it site-wide, you’ll need a custom function using a WooCommerce hook like woocommerce_loop_add_to_cart_link.

How to get a cart page URL in WooCommerce?

To get a cart page URL in WooCommerce, go to WooCommerce → Settings → Advanced. Under the “Cart Page” setting, you’ll see the assigned cart page (usually /cart). You can also use wc_get_cart_url() in the theme or plugin code to get the cart URL dynamically.

How do I add multiple products to my cart via URL in WooCommerce?

WooCommerce doesn’t natively support adding unrelated products via a single URL. But you can add multiple child items of a grouped product using:

/?add-to-cart=GROUP_ID&quantity[ID1]=2&quantity[ID2]=1

For unrelated products, you’ll need a plugin or custom code to make it work.

What is the default cart URL in WooCommerce?

By default, the cart URL is:

“https://yourstore.com/cart”

This can be changed in WooCommerce → Settings → Advanced. The URL slug depends on the page you’ve set as the cart page.

How do I create a custom add to cart button in WooCommerce?

Use any HTML button or link and point it to your custom Add to Cart URL like this:

<a href=”/?add-to-cart=101″ class=”button”>Buy Now</a>

You can style it as you like and even add quantity or redirect parameters. For full control, create your own template or shortcode with PHP.

How do I show cross-sells on the WooCommerce cart page?

WooCommerce shows cross-sells by default on the cart page if they are assigned to products. You can manage them under Product Data → Linked Products. If they’re not showing, make sure your theme includes do_action( ‘woocommerce_cart_collaterals’ ) in the cart template.

Let’s Summarize

Add to Cart URLs might seem like a small feature, but they can make a big difference in how customers shop on your WooCommerce store. From quick product additions to smart redirects, they simplify the entire purchase flow.

Whether you’re running email campaigns, using QR codes, or building custom landing pages, these URLs give you full control over the buying journey. Just follow the best practices and keep common fixes in mind.

If you need help setting this up or want to customize your store even further, our WooCommerce developers can help. Connect with our team to build smarter, faster shopping experiences.

Share this story, choose your platform!

facebook twitterlinkedin
publisher

Ankur Shah

Ankur Shah is a tech-savvy expert specializing in eCommerce solutions. With a deep understanding of WooCommerce and Shopify, he helps businesses optimize their online stores for success. Whether it's implementing new features or troubleshooting issues, Ankur is your go-to guy for all things eCommerce.

PreviousNext
Let's build a custom eCommerce store.
At BrainSpate, we recognize the power of standing out from the crowd in an effort to get more customers and product admirers. For that, you can have a consultation with us and get a free quote.
Get Free Quote
Standing Man
logo

BrainSpate is a top eCommerce development company that specializes in providing top-notch online business solutions. We cater to businesses of all sizes and offer a range of eCommerce development services.

SocialIcons SocialIcons SocialIcons SocialIcons

Our Expertise

  • eCommerce Development
  • Shopify Development
  • WooCommerce Development
  • Magento Development
  • Salesforce Development

Countries We Serve

  • CountryIcons

    Switzerland

  • CountryIcons

    Canada

  • CountryIcons

    Sweden

  • CountryIcons

    Australia

  • CountryIcons

    United Kingdom

Contact Us

  • +1 803 310 2526
  • [email protected]
  • 919, City center 2 ,
    Science City Road,
    Ahmedabad - 380060, India.
  • 3520 Aria DR,
    Melbourne
    Florida, 32904, USA.
© Copyright 2025 BrainSpate
  • All Rights Reserved
  • Privacy
  • Policies
  • Terms of Services
  • Sitemap