HS Dynamic Pricing & Discount Rules · 0.1.0-alpha.3
Pricing variations: together, separately or one size
Set rules for a variable parent, count each size separately, or discount only one variation.
Prepare a variable product
Use a published WooCommerce variable product with purchasable Small and Large variations, valid prices and stock. Choose a size before adding it to the cart. In the promotion’s Include products search, the parent selects its variations; a specific variation selects only that size. The two choices have different consequences.
Combine sizes from the same parent
- Create a Quantity: same price for every unit promotion for the T-shirt parent (€18 per size).
- Choose Set unit price and Count eligible quantities → Per parent product, combining variations.
- Add a band starting at 6 with value 16; save and activate.
- Add 3 Small and 3 Large. The combined six qualify: €48 per line, €96 total.
Five shirts remain €90. A shirt belonging to another parent does not help this parent reach six. Use Across all selected products only if products from different parents should form one group.
Require each size to reach its own quantity
Select the Polo parent (€18) and choose Per cart line. Set a band from 3 at €16. Two Small plus two Large total €72: neither line qualifies. Three Small plus three Large total €96. Three Small plus two Large total €84 (€48 + €36). This also distinguishes separate cart lines created by supported cart behavior; do not assume all rows with the same variation ID merge.
Discount only Small
Create Product discount / Percentage off / 20. Under Include products search for the Hoodie Small variation, not its parent. One Small at €50 becomes €40; one Large stays €50; together €90. Alternatively include the parent and put Large under Exclude products. Exclusions take precedence and excluded units do not count toward that rule’s quantity thresholds.
BOGO across variations with different prices
Select the parent and combine variations if different sizes should form a BOGO group. With buy 1, discount 1 at 100%, one eligible €20 size and one eligible €30 size total €30: the cheaper €20 unit is discounted. The order of adding sizes does not choose the reward. Use Per cart line to require a complete group within each line instead.
Progressive bands stay per line
Progressive pricing requires Per cart line. It does not pool five Small and one Large into a six-unit progressive band. Each line has its own original unit price and band calculation. Use bulk with parent counting when the offer really is “mix sizes to reach a threshold.”
Verify the three demo products
Open the T-shirt, Polo and Hoodie examples. Select and add both sizes separately, then change only one line in the cart. Check which line changes, checkout totals and order variation labels. If all sizes are discounted unexpectedly, inspect whether the parent was included. If combined quantities do not qualify, inspect the count scope and exclusions. Complex bundles, subscriptions and arbitrary add-on price engines are outside the validated scope.