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.
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.
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.
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.
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.
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.
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/.
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.
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:
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:
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.
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.