WooCommerce Coupon product_ids Empty: Does the Coupon Apply to All Products?
Coupon Configuration · Product Scope
WooCommerce Coupon product_ids Empty: Does the Coupon Apply to All Products?
Usually, an empty product inclusion list means “no inclusion restriction,” not “the coupon applies regardless of every other rule.” Exclusions, categories, sale-item settings, cart requirements, and discount type still matter.
Short answer: when a standard WooCommerce coupon has no product IDs selected, the coupon is not limited to a positive list of individual products. It may apply across otherwise eligible products, but excluded products, included or excluded categories, “exclude sale items,” discount type, minimum/maximum spend, email restrictions, and extension rules can still narrow or reject it.
The confusion comes from treating one stored field as the complete eligibility rule. Coupon validity is calculated from several conditions. An empty array tells you only that one particular inclusion list is empty.
Empty product_ids means “no products explicitly required by this field.” It does not mean “ignore every other coupon restriction.”
How WooCommerce resolves product scope
Think of coupon scope as a sequence:
- Discount type: percentage, fixed cart, or fixed product changes how eligible amounts are calculated.
- Positive product scope: selected product IDs and product categories can require matching items.
- Negative product scope: excluded products and categories remove items even when the positive list is broad.
- Sale-item rule: “exclude sale items” can remove products already on sale.
- Cart and customer rules: spend thresholds, allowed emails, usage limits, and individual-use settings can invalidate the coupon independently.
- Extensions and custom code: plugins can add role, country, payment, shipping, membership, or other conditions.
For product-level discounts, eligibility can apply only to qualifying line items. For a cart-level coupon, restrictions can determine whether the cart has the required qualifying content before the cart discount is granted. Always test the actual discount type rather than inferring behavior from the field name.
Common product_ids configurations
| Configuration | Practical interpretation | Important caveat |
|---|---|---|
| product_ids empty; no other product rules | No individual-product inclusion restriction | Cart, customer, sale-item, and extension rules still apply |
| product_ids contains A and B | Coupon is positively scoped to matching products | Behavior still depends on discount type and exclusions |
| product_ids empty; category included | Category provides the positive product scope | Products outside the category are not made eligible by the empty ID list |
| product_ids empty; product C excluded | Broad scope with C removed | Other exclusions may also apply |
| both included and excluded rules match | Exclusion should be treated as a deliberate boundary | Test variable products and extension behavior explicitly |
| empty arrays returned by API | No values stored for those lists | It does not summarize every validation rule |
Admin, REST API, and custom-code views
WooCommerce admin
In the coupon’s Usage restriction section, leaving Products empty generally means the coupon is not restricted to specifically selected products. Review Product categories, Exclude products, Exclude categories, and Exclude sale items on the same screen before describing the coupon as storewide.
REST API
API responses may represent unset product lists as empty arrays. Treat product_ids: [] as data about that field, not a final eligibility verdict. Read the exclusion and category arrays, discount type, spend rules, usage rules, and any extension metadata relevant to the store.
Custom PHP
Use WooCommerce coupon objects and public APIs rather than querying post meta directly. Direct meta assumptions are brittle across storage changes and can miss validation added by WooCommerce or another extension. Most importantly, do not recreate coupon eligibility from one getter when WooCommerce already has a complete validation flow.
Security and compatibility: sanitize all request input, verify nonces and capabilities for admin actions, escape output, and test both classic and Blocks checkout when custom behavior affects customers. A REST response should not be trusted merely because its JSON shape looks correct.
A safe coupon-scope test matrix
Create a staging matrix with at least these carts:
- one ordinary eligible product;
- one explicitly excluded product;
- one product from an included category;
- one product from an excluded category;
- a mixed eligible and excluded cart;
- a sale item when “exclude sale items” is on and off;
- a variable product and at least two variations;
- cart totals immediately below and above minimum spend;
- guest and logged-in customers where email or usage restrictions exist.
For each case, record whether the coupon applies, which lines receive the discount, the cart discount total, tax behavior, shipping eligibility, and the message shown when rejected. Repeat after changing discount type because fixed-cart and product discounts need not distribute value identically.
The complete WooCommerce coupon restrictions guide explains minimum spend, per-user limits, exclusions, and stacking rules in merchant-facing terms.
Common mistakes
- Equating empty with unrestricted: other fields can still narrow eligibility.
- Ignoring exclusions: a broad inclusion does not make deliberate exclusions irrelevant.
- Testing only an all-eligible cart: mixed carts reveal product-level distribution issues.
- Reading storage directly: raw meta is not the same as WooCommerce’s validation result.
- Forgetting variations: parent and variation behavior should be tested with the store’s actual configuration.
- Blaming scope for a payment-state error: a coupon blocked after payment starts may be valid but too late to alter the active amount.
If eligibility looks correct yet the code is still rejected, use the cause-by-cause coupon diagnostic. If the message mentions an ongoing payment session, use the dedicated payment-session coupon error guide.
Frequently asked questions
Does product_ids: [] make a WooCommerce coupon storewide?
It removes the individual-product inclusion list as a restriction. The coupon can still be narrowed by categories, exclusions, sale-item rules, discount type, cart rules, customer rules, and extensions.
Do excluded products still matter when product_ids is empty?
Yes. Empty inclusions and explicit exclusions serve different purposes. A broad coupon can still deliberately exclude particular products or categories.
Should custom code check product_ids directly?
It can inspect the field for a specific integration need, but it should not treat that check as complete coupon validation. Prefer WooCommerce coupon objects and validation APIs over direct database assumptions.
Key takeaways
- An empty product_ids array means no explicit individual-product inclusion list.
- Categories, exclusions, sale-item settings, cart rules, and customer rules still matter.
- Discount type changes how eligible value is calculated.
- Test mixed carts, variations, sale items, thresholds, and checkout types in staging.
- Use WooCommerce APIs and full validation flow instead of rebuilding eligibility from raw meta.