Table of Contents
Problem Description #
The coupon URL should add a product or variation to the cart automatically but either nothing is added, the wrong quantity is added, or the product variation is incorrect.
Symptoms
- No product appears in cart after following URL.
- A different product appears or a simple product added instead of the chosen variation.
- Product added but quantity is 0 or defaults incorrectly.
Typical cause:
Incorrect product ID, using variable product without variation ID/attributes, product out of stock, or the URL format for adding products is incorrect.
Solution-step-by-step
- Verify product IDs and URL format
- Confirm you are using the correct product ID (not product SKU unless plugin supports SKU). For simple product: ?add-to-cart=123. For variation, many plugins require variation ID and attributes like ?variation_id=456&attribute_pa_color=red. Confirm plugin docs for exact format. WPFactory
- Confirm product status
- Check product is published, in stock, and purchasable (not private or restricted).
- Test simple product first
- Test the simplest case: add a simple product via URL and verify it appears in the cart. If this works, the issue is likely variation or parameter formatting.
- Variation handling
- If adding a variation, use the variation ID (not parent product ID) and ensure attributes are provided exactly as stored (attribute slugs). Example:
https://example.com/?add-to-cart=123&variation_id=456&attribute_pa_size=large - Misspelled attribute names or wrong slugs will cause fallback to parent or no addition.
- If adding a variation, use the variation ID (not parent product ID) and ensure attributes are provided exactly as stored (attribute slugs). Example:
- Check plugin-specific “empty cart” setting
- If the plugin empties the cart before adding products, ensure this behavior is intended; otherwise disable it to preserve cart contents. WPFactory
- Test for conflicts
- Temporarily disable plugins that manipulate cart item additions (other add-to-cart handlers, subscription plugins, or custom snippets).
Prerequisites:
- Proper product/variation IDs.
- Plugin version supporting auto-add products.
Additional notes:
For complex bundles or composite products, URL addition may require special handling and not be supported by a simple query parameter.
