API v1.0.346 Release Notes
Released on Thursday, May 23, 2024
New
The rules engine now supports an
ifs()
function.This can be used to support evaluation of tiered threshold discounts. For example: spend $10 on Category A get 5% off, spend $30 get 10% off, spend $50 get 15% off would be written like this:
EligibleExpression: "items.total(product.incategory('A') >= 10 and item.product.incategory('A')"
ValueExpression: "ifs(items.total(product.incategory('A')) >= 50, item.LineSubtotal * .15, items.total(product.incategory('A')) >= 30, item.LineSubtotal * .10, item.LineSubtotal * .05)"
The final parameter in the function is the fall back (think of it as
default
in a switch statement, or anelse
) that is used if none of the conditions are met, in this case, we included the minimum spend in the eligible expression, so the fall back is a 5% discount.