Rule Applies
Function: ruleApplies()
ruleApplies(
rule,cartItems,subtotal):boolean
Defined in: amerta/theme/utilities/cart.ts:36
Determines if a rule applies to the cart based on its trigger type and values.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| rule | any | The rule object containing trigger information. |
| cartItems | any[] | Array of cart items to check against the rule. |
| subtotal | number | The subtotal amount of the cart. |
Returns
boolean
True if the rule applies, false otherwise.
Example
const applies = ruleApplies(ruleObj, cartItems, 150);