Search

Mar 29, 2023

Magento 2: Discard subsequent rules not working in Catalog Price Rule

Step by step:

0. Create rules:

1. Rule 1: USFlat20
    Apply as fixed amount: 20$
    Priority: 0
    Discard subsequent rules: No

2. Rule 2: USFlat10
    Apply as fixed amount: 10$
    Priority: 1
    Discard subsequent rules: Yes

3. Actual result: 
We've used the 'Discard subsequent rules' feature in Rule 2 but it doesn't seem to work.


CAUSE:

Let's analyze the situation from the screencast you provided:
You have two rules:
    + USFlat20 with priority 0 for -20$ and discard subsequent rules set to No
    + USFlat10 with priority 1 for -10$ and discard subsequent rules set to Yes

The test product is $74.38. Now how rules are applied:
    1. Get the list of rules ordered by priority in ascending order -> 1. USFlat20, 2. USFlat10
    2. Apply discount from the first rule -> USFlat20: 74.38 - 20 = 54.38
    3. Discard subsequent rules? -> No
    4. Apply discount from the second rule -> USFlat10: 54.38 - 10 = 44.38
    5. Discard subsequent rules? -> Yes
    6. End

As you can see the final price is now $44.38 and this is exactly what is visible in the screencast.

Now if we switch priorities for the above rules:
    + USFlat20 with priority 1 for -20$ and discard subsequent rules set to No
    + USFlat10 with priority 0 for -10$ and discard subsequent rules set to Yes

Again test product is $74.38, and rules are applied like this:
    1. Get the list of rules ordered by priority in ascending order -> 1. USFlat10, 2. USFlat20
    2. Apply discount from the first rule -> USFlat10: 74.38 - 10 = 64.38
    3. Discard subsequent rules? -> Yes
    4. End

In such a setup, the final price is $64.38.

This behavior is described in the documentation price-rules-catalog-create

No comments:

Post a Comment