Your Cart
WooCommerce add-to-cart URLs

How to Create WooCommerce Add-to-Cart URLs for Products, Variations and Campaign Pages

WooCommerce add-to-cart URLs let you connect a campaign, landing page or promotional call to action with a specific product in the cart. Instead of asking visitors to open a product page and complete every selection themselves, a link can use a product ID, a quantity parameter or a variation ID to prepare the intended purchase flow. The destination may remain a store page, lead to the cart or use the configured checkout page.

These URLs are useful for campaign buttons, email links and landing pages, but they should be treated as documented URL patterns rather than a universal solution for every product type or extension. This guide explains the traditional add-to-cart format, variation-specific links, quantity control, direct checkout and WooCommerce’s separate shareable checkout-link format. Each URL should be tested with the store’s own products, page configuration and active integrations before publication.

What WooCommerce Add-to-Cart URLs Are Used For

An add-to-cart URL contains query parameters attached to a store URL. WooCommerce can use the product identifier in that query to add a product to the cart. The same approach can support a specified quantity and, when the correct variation ID is used, target an individual variation rather than only the parent variable product.

This makes the format practical when a campaign promotes one clearly defined offer. A landing page can link directly to a selected product, while a promotional button can add the intended item before sending the visitor to another store destination. The URL itself does not establish campaign performance or guarantee a better conversion result. Its role is to define the product and, where documented, the quantity and destination used in the flow.

Traditional add-to-cart URLs versus shareable checkout links

The traditional approach uses an add-to-cart query parameter. For a simple product, the value is the product ID, and a quantity parameter can be added when the link should place a specified number of units in the cart. A separate WooCommerce-documented approach uses a /checkout-link/ path and a products parameter containing product IDs and quantities.

These formats are related, but they should not be treated as identical. The first is the familiar add-to-cart query pattern. The second is a shareable checkout-link format intended to populate checkout directly. Whichever approach you use, verify it against the store’s configuration and the particular product type.

Finding Product and Variation IDs

The URL is only as reliable as the identifier placed in it. Use IDs from the same WooCommerce store, and do not guess them or copy them from another website. A simple product ID and a variation ID identify different objects, so substituting one for the other can result in the wrong item being added or in a link that does not behave as intended.

For a simple product, WooCommerce’s documented method is to open WooCommerce > Products in the WordPress admin and hover over the product title. The product ID is shown there. Record the value exactly as displayed in that store.

Simple product IDs and variation IDs

A simple product uses its product ID in the basic add-to-cart pattern. A variable product can contain separate variations, such as a particular color or configuration. To target one of those choices, use the variation ID associated with the desired variation. The parent variable product and its individual variations should not be treated as interchangeable.

Open the relevant product’s Variations area and identify the exact variation required by the campaign. Before distributing the link, confirm that the selected variation is enabled, in stock and purchasable. A controlled test product or staging environment provides a safer way to validate the identifier before it is placed in advertising, email or a public landing page.

Creating a Basic Add-to-Cart URL for a Simple Product

The core pattern for a simple product is:

?add-to-cart=PRODUCT_ID

Replace PRODUCT_ID with the ID taken from the store’s WooCommerce admin. The question mark introduces the query string, while add-to-cart tells WooCommerce which product identifier the link should use. The placeholder is intentionally generic: every store has its own product IDs, and a value from another website cannot be assumed to work in your installation.

The query string can be attached to an appropriate URL on the store’s own domain. The destination should be selected according to the intended flow and verified in the store. A campaign may require the visitor to continue on a page, review the cart or proceed directly to checkout. Do not assume that every installation uses the same page paths or that the simple pattern supports every customization offered by a third-party extension.

Before publication, open the link in a controlled test session and confirm that the expected product appears in the cart. Check the result before using it in a paid campaign, email or public landing page. If the URL points to a product with add-ons, customization fields or another extension-specific configuration, treat those additional requirements as unsupported unless the relevant extension documentation confirms them.

Adding a quantity to the URL

When the campaign must add more than one unit, append a quantity parameter to the add-to-cart URL:

?add-to-cart=PRODUCT_ID&quantity=QUANTITY

Replace both placeholders with values from the store and the intended offer. The quantity parameter is useful when a link represents a defined quantity rather than a single-unit purchase. During testing, inspect the cart and confirm that the resulting number of units matches the campaign message. Do not rely only on the appearance of the URL; verify the actual cart contents.

Creating a Link for a Specific Product Variation

A variable product may represent several choices, but a campaign often refers to one precise option. In that case, use the variation ID as the value of add-to-cart, rather than using only the parent product’s ID. The documented pattern is:

?add-to-cart=VARIATION_ID

Replace VARIATION_ID with the identifier of the exact variation selected in the product’s Variations area. This can target a particular color or configuration. If a quantity is also required, the quantity parameter can be added to the query string:

?add-to-cart=VARIATION_ID&quantity=QUANTITY

The important distinction is that the link should add the intended variation, not merely open or add the parent variable product. Confirm the variation details shown in the cart, including the selected option represented by the campaign. Also check stock status and purchasability before distributing the URL. The sources do not establish that every product option, subscription configuration or third-party customization is supported by this pattern.

Variation-specific testing

Test the link in a controlled session before publishing it. Open the URL, inspect the cart and verify that the intended variation is present. Repeat the check in the contexts that matter for the campaign, including mobile users and both logged-in and guest customers. If the cart shows only the parent product, the wrong variation ID may have been used or the specific product configuration may require behavior not covered by the documented URL format.

Sending Customers Directly to Checkout

A link can add a product and use the checkout page as its destination. The general structure combines the checkout URL with the same query parameters:

CHECKOUT_URL?add-to-cart=PRODUCT_ID&quantity=QUANTITY

The placeholders must be replaced with the store’s configured checkout URL, the correct product or variation ID and, when required, the intended quantity. This creates a direct-checkout flow after the product is added. It does not establish that checkout will improve campaign performance, and it should not be published without testing the complete payment path.

Use the store’s own checkout destination rather than assuming that every WooCommerce installation uses a universal /checkout/ path. Page configuration can differ between stores. The same caution applies to the cart: a hard-coded /cart/ path should not be treated as guaranteed for every installation.

Configured cart and checkout URLs

WooCommerce provides wc_get_cart_url() and wc_get_checkout_url() for obtaining the configured cart and checkout URLs. This confirms the practical reason to verify the pages used by the individual store instead of blindly constructing a destination from a presumed path. A URL that works on one installation may need a different destination on another.

Test the direct-checkout flow for guests, logged-in customers, mobile users and the active payment flow. Confirm that the product and quantity are retained and that the customer reaches the intended checkout page. Do not place private customer, order or session information in a campaign URL. If a cart-first flow is easier to validate for the product or integration involved, use that approach rather than assuming direct checkout is appropriate in every case.

Shareable Checkout Links and Multiple Products

WooCommerce also documents a separate shareable checkout-link format. It uses a /checkout-link/ path and a products parameter containing product IDs and quantities. The documented product-and-quantity structure is:

/checkout-link/?products=PRODUCT_ID:QUANTITY

This approach is distinct from the traditional add-to-cart query. It is intended to populate checkout with products and quantities. The documented format supports simple products and can use the correct variation ID when an individual variation is required. Use identifiers from the same store and verify the result in the actual checkout flow.

WooCommerce also documents optional coupon support for this checkout-link format. That does not mean that arbitrary parameters from another extension can be added safely. Treat extension-specific parameters as unsupported unless the relevant extension’s official documentation confirms them. The available source material also does not establish a general compatibility matrix for every WooCommerce product type or extension.

Choosing between the two URL approaches

Choose the traditional query format when the campaign requires the documented add-to-cart pattern, including a product or variation ID and an optional quantity. Consider the shareable checkout-link format when the intended flow is to populate checkout directly with products and quantities. Keep the two structures separate when building and reviewing campaign URLs.

For multiple products, use only the documented checkout-link syntax and test the resulting checkout contents with the store’s actual products. Do not assume that a product combination, add-on or customization field will be carried through merely because a product ID appears in the URL. Verify each use case before publication.

WooCommerce Add-to-Cart URL Troubleshooting and Testing Checklist

Most URL problems can be narrowed down by checking the identifier, the destination and the product’s purchasing state. The documented patterns explain how WooCommerce can receive product and quantity values, but they do not guarantee compatibility with every active plugin, extension or custom product configuration.

Test campaign URLs in staging or with a controlled product before exposing them to visitors. The research does not independently verify behavior under caching, security, multilingual, membership or payment-gateway plugins, so these integrations should be treated as testing considerations. Check the complete flow rather than assuming that a link which opens successfully has also added the correct item.

Pre-publication checklist

  1. Confirm the identifier. Use the product ID or exact variation ID from the same store’s WooCommerce admin.
  2. Check the product state. Confirm that the chosen variation is enabled, in stock and purchasable before distributing its link.
  3. Review the query. Verify the add-to-cart value and, when needed, the quantity value.
  4. Verify the destination. Use the store’s configured checkout URL instead of assuming a universal cart or checkout path.
  5. Inspect the cart. Confirm that the expected product, variation and quantity appear after opening the link.
  6. Test checkout. Check the flow for guests, logged-in customers, mobile users and the active payment process.
  7. Test integrations. Check caching, security, multilingual, membership and payment-gateway behavior in the actual store context.
  8. Limit assumptions. Do not assume that product add-ons, customization fields, subscription configurations or third-party parameters are supported.
  9. Protect customer data. Keep private customer, order and session information out of campaign URLs.
  10. Test before publication. Validate every link in staging or with a controlled product before using it in advertising, email or a public page.

WooCommerce add-to-cart URLs are built around a small set of documented values: the product or variation ID, an optional quantity and the destination used by the store. The traditional query format is useful for adding an item to the cart, while the separate shareable checkout-link format is designed to populate checkout with products and quantities. Neither should be assumed to cover every extension or product configuration. Verify IDs, stock, purchasability, configured page URLs and the complete customer flow before publication. Explore our WordPress plugins, WooCommerce extensions, themes and membership plans to find the right tools for your website.

Free Worldwide shipping

You can download the products right away at wpbetterplugins.com

Immediate delivery

After the payment is credited, the product is ready for download

International Warranty

Offered in the country of usage

100% Secure Checkout

Stripe / Apple Pay / Google Pay / MasterCard / Visa

Zadzwoń