Change strike-through price based on customer email domain
Rule breakdown, resource payload analysis, and outcomes explanation
This rule discounts the compare-at amount of a price for logged customers whose email address matches a specific domain. The customer email is checked and a percentage discount is applied to the related price. Applying this rule to a price list will result in updating the compare-at amount of all its prices for a subset of logged customers.
The example below is based on the following reference JSONs. Once the rules are evaluated against the resource payload, the outcomes show if and how the conditions are matched and the related actions applied.
Rules breakdown
The desired results can be achieved with a single rule.
Conditions
The only condition in the rule checks if the customer email belongs to the domain .*@mybrand.com
.
Actions
The only action in the rule applies a 20% discount to the compare_at_amount_cents
value of the prices that match the condition.
Resource payload analysis
The provided payload contains a price associated with a logged customer whose email is john.doe@mybrand.com
, thus qualifying for the discount.
Result check
The outcomes reflect the evaluation of the rules against the resource payload. Since the price satisfies the condition, the rule matches successfully (match
is true
). The price and the logged customer IDs are listed within the matches
array. The action is applied to the price's compare_at_amount_cents
attribute with a decimal value of 0.2
corresponding to the specified percentage discount.
Conclusion
The rule matches the provided price payload. Consequently, a 20% discount is applied to the strike-through price due to its association with a customer's email that matches the specified domain.
Last updated