> For the complete documentation index, see [llms.txt](https://help.dollarlabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.dollarlabs.io/dollarlabs-ultimate-discounts/discount-engine-v1/rule-builder-variables.md).

# Rule Builder Variables

The variables in the Dollar Discounts rule engine are essential for creating robust discounts by combining them using simple AND & OR conditions. Below is an explanation of the key types and conditions, followed by a table of rule options.

***

### Key to Conditions

* **Equal (EQ):** The value must be exactly equal.
* **Not Equal (NQ):** The value must not be equal.
* **Starts With (SW):** The value must start with the specified text.
* **Ends With (EW):** The value must end with the specified text.
* **Greater Than (GT):** The value must be greater than the specified amount.
* **Lesser Than (LT):** The value must be less than the specified amount.
* **Divisible By (DB):** The value must be divisible by the specified amount.
* **Matching ONE of (CO):** The list must contain at least one of the specified values.
* **Matching ALL of (CA):** The list must contain all the specified values.
* **Not matching (NC):** The list must not contain any of the specified values.

***

### Key to Types

* **Currency:** Refers to money-related values, typically involving price or cost. Always defined in store currency.
* **Number:** Refers to numerical values, such as quantities or counts.
* **String:** Refers to text values.
* **Array:** Refers to a collection of values, such as lists of IDs, tags, or locations.
* **Boolean:** Refers to true/false values, indicating binary states such as authenticated or not authenticated.

***

### Rule Options

#### Cart Rules

<table><thead><tr><th width="204">Rule Option</th><th width="89">Type</th><th width="143">Conditions</th><th>Description</th></tr></thead><tbody><tr><td>Cart Attribute</td><td>String</td><td>EQ, NQ, SW, EW</td><td>An attribute of the cart</td></tr><tr><td>Cart subtotal</td><td>Currency</td><td>EQ, LT, GT</td><td>The subtotal value of the cart</td></tr><tr><td>Cart Quantity</td><td>Number</td><td>EQ, LT, GT, DB</td><td>The quantity of items in the cart</td></tr><tr><td>Cart Market</td><td>Array</td><td>CO, NC</td><td>The market associated with the cart</td></tr><tr><td>Cart Has Product</td><td>Array</td><td>CO, NC, CA</td><td>Whether the cart has specific products</td></tr><tr><td>Cart Has Variant</td><td>Array</td><td>CO, NC, CA</td><td>Whether the cart has specific variants</td></tr></tbody></table>

#### Customer Rules

<table><thead><tr><th width="225">Rule Option</th><th width="102">Type</th><th width="131">Conditions</th><th>Description</th></tr></thead><tbody><tr><td>Customer logged in</td><td>Boolean</td><td>EQ</td><td>Whether the customer is authenticated</td></tr><tr><td>Customer is B2B</td><td>Boolean</td><td>EQ</td><td>Whether the customer is a business</td></tr><tr><td>Customer Spent</td><td>Currency</td><td>EQ, LT, GT</td><td>The total amount spent by the customer</td></tr><tr><td>Orders Count</td><td>Number</td><td>EQ, LT, GT, DB</td><td>The number of orders placed by the customer</td></tr><tr><td>Customer ID</td><td>Array</td><td>CO, NC</td><td>The IDs associated with the customer</td></tr><tr><td>Customer Tags</td><td>Array</td><td>CO, CA, NC</td><td>The tags associated with the customer</td></tr><tr><td>Customer Company</td><td>Array</td><td>CO, NC</td><td>The company ID associated with the customer</td></tr></tbody></table>

#### Line Item Rules

<table><thead><tr><th width="163">Rule Option</th><th width="103">Type</th><th width="117">Conditions</th><th>Description</th></tr></thead><tbody><tr><td>Line Attribute</td><td>String</td><td>EQ, NQ, SW, EW</td><td>An attribute of the line item</td></tr><tr><td>Line Quantity</td><td>Number</td><td>EQ, LT, GT, DB</td><td>The quantity of the line item</td></tr><tr><td>Line Subtotal</td><td>Currency</td><td>EQ, LT, GT</td><td>The total cost of the cart line item (price x quantity)</td></tr><tr><td>Variant ID</td><td>Array</td><td>CO, NC</td><td>The variant IDs associated with the line item</td></tr><tr><td>Product ID</td><td>Array</td><td>CO, NC</td><td>Shopify Product ID of the item in the user's cart</td></tr><tr><td>Product Tag</td><td>Array</td><td>CO, CA, NC</td><td>Product tag of the item as set up in the admin UI.</td></tr><tr><td>Product Collection</td><td>Array</td><td>CO, CA, NC</td><td>The collections associated with the line item</td></tr><tr><td>Selling Plan Allocation</td><td>Boolean</td><td>EQ</td><td>Whether the line item has a selling plan</td></tr></tbody></table>
