Which SKU should you use for a variant discount in Magento 2?

2 min read

Olive knitwear in a box with two different-sized paper tags

A shopper selected SHIRT-RED, but the coupon gives no discount from the entry for that SKU. Start by checking the SKU the module reads on the line that the rule actually processes.

Use one rule and two variants

In Discount Rule per Product, select an active coupon rule. Prepare a configurable SHIRT and two variants priced at PLN 100 each. Test one unit with TEST15 in the same store view. Enable one 15% entry at a time for the parent SKU or SHIRT-RED and refresh totals between attempts.

Compare the lookup key and line discount

In the isolated 1.0.59 test, the rule received the parent row. Its current SKU could show the selected variant while the original product SKU was SHIRT. The plugin used the original SKU to look up an active entry in the store scope.

Amount set by the plugin in PLN
CaseEntry SKUSelected variantSKU looked upDiscount
Parent with redSHIRTSHIRT-REDSHIRT15
Parent with blueSHIRTSHIRT-BLUESHIRT15
Variant entry with redSHIRT-REDSHIRT-REDSHIRT0
Variant entry with blueSHIRT-REDSHIRT-BLUESHIRT0

The SHIRT entry gave PLN 15 in both cases. SHIRT-RED did not match the key looked up. The table shows the discount at the handoff to the native validator. Per-SKU discount documentation

Use the SKU read from the processed row

If the rule processes the parent line, check its catalog SKU and scope of the active entry. Select both variants in turn and check the final recalculated cart discount. If other promotions are present, also read the applied rule IDs. Guide to overlapping discounts

Previous Next

KOWAL.BLOG

Choose your language

Available versions open the corresponding page. More languages are being prepared.

English (UK) Français Deutsch Español Italiano Português Nederlands Svenska Dansk Norsk Suomi Lietuvių Latviešu Eesti Čeština Slovenčina Magyar Română Български Ελληνικά Slovenščina Hrvatski Polski English (US)