Conditions
Conditions decide when a promotion can be applied. There are four kinds, and all four must pass before a promotion applies:
- Cart conditions, in the promotion's
CartCondition: requirements the whole cart must meet, such as the type of customer. - Line conditions, in the promotion's
LineCondition: requirements a line item must meet, such as not already having a sale price. - Product conditions, in the
PromotionType's product fields (such asItemsToMatch): which products the promotion applies to. - Package conditions, in a product condition tree's
PackageConditionnode: requirements the package selected for a line item must meet, such as how close it is to its expiry date.
Condition trees
Each kind of condition is a tree of nodes. Every node has a Type field that says what kind of node it is and which other fields it has. A tree must evaluate to true for the promotion to apply.
Every kind of condition has the same four logical nodes for building trees:
Node (Type) | Fields | Evaluates to true when |
|---|---|---|
AllOf | Conditions: a list of nodes of the same kind | Every node in Conditions is true. |
AnyOf | Conditions: a list of nodes of the same kind | At least one node in Conditions is true. |
NoneOf | Conditions: a list of nodes of the same kind | Every node in Conditions is false. |
None | Always. A no-op, which can be a node in a tree or a whole tree on its own. |
Most other nodes have a bit in the condBits capability bitmask. Promotions with a node whose bit you don't supply aren't returned. The logical nodes and the CatalogId product condition have no bit, so every integration must implement them.
Product conditions
A ProductCondition tree filters which products a promotion applies to. A line item is applicable to the promotion only if the entire tree evaluates to true for its product.
Node (Type) | Fields | Evaluates to true when the line item's product |
|---|---|---|
CatalogId | Id (guid): a CatalogId | Has the given CatalogId. |
Classification | ParentCategoryOrClassificationId (int32): a parent category or classification ID | Belongs to the given parent category or classification. |
NonStock | Is a non-stock product. | |
BatchTracked | Is batch-tracked. | |
GiftCard | Is a gift card. | |
Regular | Is a regular product. | |
ContainsCannabis | Contains cannabis. | |
IsGram | Is sold by the gram. | |
IsEach | Is sold by the each. | |
Supplier | SupplierId (int32): a supplier ID | Belongs to the given supplier. |
SpecificationValue | StringId (string), FieldId (int32), Value (string) | Has a specification value matching the StringId/FieldId, with a value matching Value (case-insensitive). |
PackageCondition | PackageCondition: a PackageCondition tree | The package selected for the product satisfies the given package condition tree |
All fields
Every field a ProductCondition node can have. Which are populated depends on its Type.
| Name | Type |
|---|---|
Type | string |
Conditions | ProductCondition[]? |
ParentCategoryOrClassificationId | int32? |
Id | guid? |
SupplierId | int32? |
StringId | string? |
Value | string? |
FieldId | int32? |
PackageCondition | PackageCondition |
Matching product data
To check whether a product matches these conditions, you need its product data from Cova. This assumes you're already caching it from the Data Platform DetailedProductData endpoints. This table shows where each condition's data is in a DetailedProductData response.
| Node | Property in DetailedProductData | Matches when |
|---|---|---|
CatalogId | ProductId | Equal to Id. These conditions are always returned by the promotion endpoints. |
Classification | ClassificationId | The promotion's ParentCategoryOrClassificationId may be a category rather than a classification. Set IncludeClassifications: true on DetailedProductData requests and check the Classifications collection for the category structure. |
NonStock | IsNonStock | true |
BatchTracked | IsBatchTracked | true. Subject to state traceability; usually means "contains cannabis". |
GiftCard | ProductSpecifications[] | A field exists with a DisplayName of "Integrated Gift Card" and a value of true/yes. Set IncludeProductSpecifications: true on DetailedProductData requests. |
Regular | IsNonStock | false |
ContainsCannabis | ProductSpecifications[] | A field exists with a DisplayName starting with "Retail Marijuana Product Type" and a value that isn't null or empty. Set IncludeProductSpecifications: true on DetailedProductData requests. |
IsGram | MeasurementType | Mass |
IsEach | MeasurementType | SingleUnit |
Supplier | SupplierSkus[] | An entry's SupplierId equals the condition's. Set IncludeProductSkusAndUpcs: true on DetailedProductData requests. |
SpecificationValue | ProductSpecifications[] | A specification's FieldId matches, and its value exactly matches Value. Set IncludeProductSpecifications: true on DetailedProductData requests. |
Package conditions
Package conditions control how promotions should apply to specific product packages. Package conditions form a condition tree stored within a PackageCondition node within a product tree.
For the AllOf and AnyOf nodes within a package condition tree, the children conditions are stored under the PackageConditions property.Example
Package date condition
A package date condition is evaluated by comparing the current date to a specific date from the package being evaluated.
Package date conditions can be used to form conditions like:
- When within 12 days of the package's expiry date
- When more than 20 days past the package's harvest date
Package Date conditions have three properties that control how the condition is evaluated:
DateType- Which package date should be used for comparisonOperator- How the current date should be compared to the chosen package dateDays- The number of days to use for the date comparison
Package Date conditions have the following parameters:
| Parameter | Type | Description |
|---|---|---|
| Type | PackageDate | Identifies the package condition as a Package Date condition |
| DateType | One of:
| The package date to compare against |
| Operator | One of:
| How to compare the current date to the chosen package date |
| Days | integer | Must be non-negative |
Start & End Dates
Each DateType is classified as either a Start Date, or an End Date.
Start Dates:
PackagedDateProductionDateHarvestDateTestDate
End Dates:
ExpiryDateUseByDate
Evaluation
The Package Date condition is evaluated in the following manner based on whether the DateType is a start or end type:
| Date Type is Start / End date | Operator | Condition |
|---|---|---|
| Start Date | IsWithin | (current date) <= (package date) + (# of days) |
| Start Date | IsMoreThan | (current date) > (package date) + (# of days) |
| End Date | IsWithin | (current date) >= (package date) - (# of days) |
| End Date | IsMoreThan | (current date) < (package date) - (# of days) |
Examples
When within 10 days of the expiry date (an end date)
{
"Type": "PackageDate",
"DateType": "ExpiryDate",
"Operator": "IsWithin",
"Days": 10
}
| Expiry Date | Current Date | Evaluates To |
|---|---|---|
| April 20, 2026 | April 12, 2026 | true |
| April 20, 2026 | April 25, 2026 | true |
| April 20, 2026 | April 5, 2026 | false |
When within 10 days of the test date (a start date)
{
"Type": "PackageDate",
"DateType": "TestDate",
"Operator": "IsWithin",
"Days": 10
}
| Test Date | Current Date | Evaluates To |
|---|---|---|
| April 10, 2026 | April 5, 2026 | true |
| April 10, 2026 | April 15, 2026 | true |
| April 10, 2026 | April 25, 2026 | false |
When more than 10 days before the expiry date (an end date)
{
"Type": "PackageDate",
"DateType": "ExpiryDate",
"Operator": "IsMoreThan",
"Days": 10
}
| Expiry Date | Current Date | Evaluates To |
|---|---|---|
| April 20, 2026 | April 15, 2026 | false |
| April 20, 2026 | April 25, 2026 | false |
| April 20, 2026 | April 5, 2026 | true |
When more than 10 days after the test date (a start date)
{
"Type": "PackageDate",
"DateType": "TestDate",
"Operator": "IsMoreThan",
"Days": 10
}
| Test Date | Current Date | Evaluates To |
|---|---|---|
| April 10, 2026 | April 5, 2026 | false |
| April 10, 2026 | April 15, 2026 | false |
| April 10, 2026 | April 25, 2026 | true |
Cart conditions
A CartCondition tree filters which carts a promotion can apply to. Some of its nodes need information about the customer or the sale that your integration may not have.
Node (Type) | Fields | Evaluates to true when |
|---|---|---|
MedCustomer | The customer is a medical customer. | |
RecCustomer | The customer isn't a medical customer. | |
CustomerInPricingGroup | PricingGroupId (int32): a pricing group ID | The customer belongs to the given pricing group. |
CustomerNotInPricingGroup | The customer doesn't belong to any pricing group, or there's no customer on the sale. | |
NoInvoiceLevelDiscountOnCart | The cart doesn't have an invoice-level discount applied. | |
NoLoyaltyDiscountOnCart | The cart doesn't have a loyalty discount applied. |
Line conditions
A LineCondition tree filters which line items a promotion can apply to. Some of its nodes need information about pricing that your integration may not have.
Node (Type) | Fields | Evaluates to true when the line item |
|---|---|---|
NoSalePricing | Isn't using sale pricing. | |
NoTierPricing | Isn't using tier pricing. | |
NoGroupPricing | Isn't using group pricing. | |
NoManualLineDiscount | Doesn't have a manually applied line discount. |