For this use case, the criterion qualifies the message named combo discount for customers by comparing attribute values from more than one complex attribute category.
The two complex attribute categories are cart and wallet.
These are the associated attribute values for the complex attribute category named cart:
price | upc |
---|---|
1.29 | 123 |
0.5 | 245 |
The following are the associated attribute values for the complex attribute category named wallet:
discount | upc |
---|---|
20 | 123 |
30 | 245 |
The criterion qualifies the combo discount message for the customer only when the following is true:
The cart and wallet complex attribute categories both have upc attribute values of 123 and 245 AND the final price for upc 123 is greater than the final price for upc 245. Calculation of the final price of a the upc is made by price - (price * (discount / 100)).
Sample Criterion Expression Syntax
set("cart", get("Account.cart")) && set("wallet", get("Account.wallet")) && set("filterCartOn123", filter(cart, "upc", "123")) && count(filterCartOn123) > 0 && set("filterWalletOn123", filter(wallet, "upc", "123")) && count(filterWalletOn123) > 0 && set("filterCartOn245", filter(cart, "upc", "245")) && count(filterCartOn245) > 0 && set("filterWalletOn245", filter(wallet, "upc", "245")) && count(filterWalletOn245) > 0 && set("cart123", get(filterCartOn123, 0)) && set("wallet123", get(filterWalletOn123, 0)) && set("price123", value(get(cart123, "price"))) && set("discount123", value(get(wallet123, "discountPercent"))) && set("adjustedPrice123", price123 - (price123 * (discount123 / 100))) && set("cart245", get(filterCartOn245, 0)) && set("wallet245", get(filterWalletOn245, 0)) && set("price245", value(get(cart245, "price"))) && set("discount245", value(get(wallet245, "discountPercent"))) && set("adjustedPrice245", price245 - (price245 * (discount245 / 100))) && adjustedPrice123 > adjustedPrice245