# Checkout validation

Checkout Validation lets you control **when a cart is allowed to become an order** by enforcing rules based on the cart, customer, or line items. You can **block**, **soft warn**, or **validate at different stages** of the checkout flow—giving you fine-grained control over who can place an order and under what conditions.

This article explains:

* What checkout validation is
* The different validation block types
* How cart groups and rules work
* All supported variables you can use in rules

{% embed url="<https://dollarlabs.neetorecord.com/watch/467ef7a8ee4f11922d1b>" %}

***

### What is Checkout Validation?

Checkout validation allows you to **prevent or warn customers** from completing an order unless specific conditions are met.

Common use cases include:

* Enforcing a **minimum order quantity** (e.g. at least 10 items)
* Enforcing a **minimum cart subtotal**
* Restricting orders to **logged-in users or B2B customers**
* Applying rules only for **specific products, customers, or markets**

If a cart does not meet the defined rules, the customer is either:

* Blocked immediately,
* Blocked at checkout completion, or
* Shown a warning (soft block).

***

### Validation Block Types

You can choose **when and how** the validation is applied:

#### 1. **Block at Cart**

* Validation is enforced **while adding items to cart**
* Customers cannot add items if rules aren’t met
* Error message can appear on:
  * Product page
  * Cart page
  * Slide cart&#x20;

**Example:**\
Customer cannot add items unless the cart quantity is 10 or more.

***

#### 2. **Block at Checkout Completion**

* Customers can freely edit the cart
* Validation happens **only when clicking “Pay Now”**
* Order is blocked if rules are not satisfied

**Example:**\
Customer fills checkout details but is blocked at payment because the minimum quantity is not met.

{% hint style="info" %}
We suggest to stick to this unless you definitely need to block at storefront itself, this is because when set to block at cart – it makes it difficult for the customer to freely modify the existing items in cart.
{% endhint %}

***

#### 3. **Show Warning in Checkout (Soft Block)**

* Displays a warning message in checkout
* **Does not block the order**
* Customer can still proceed and pay

**Example:**\
“The recommended minimum order quantity is 10 items; otherwise, a surcharge of $10 is applied.”

***

### Cart Groups

Checkout validation uses a **group-based logic system**, similar to Shopify’s discount rule builder.

#### How Cart Groups Work

* You can create **multiple cart groups**
* Each group can contain **multiple conditions**
* Conditions within a group can be combined using:
  * **AND**
  * **OR**
* Cart groups can then be referenced in the **Rules** section

This allows you to build **simple or highly advanced logic**, such as:

* Minimum quantity **AND** customer is logged in
* B2B customers **OR** specific product collections
* Different rules for different customer segments

{% hint style="info" %}
For every group, we calculate the following and make it avialable to use in the Rules section.&#x20;

Total cart amount\
Subtotal cart amount\
Line count\
Quantity sum\
Unique product count\
Unique variant count
{% endhint %}

Based on what is set up in the rules section, the cart either passes the validation or not. If it fails - then the message configured is shown at the touchpoint specified in the **Validation Block Type.**

***

### Example: Enforcing Minimum Cart Quantity

**Goal:** Customer must purchase **at least 10 items**

**Rule setup:**

* Variable: `Cart quantity (Quantity sum)`
* Condition: `greater than`
* Value: `9`\
  \&#xNAN;*(greater than 9 = 10 or more)*

{% hint style="info" %}
Or alternatively - you could just use the default ALL group and use the Quantity sum > 9 check to validate this without creating a cart group.

![](https://2844543096-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcVBfwy7Yj4tU8TsxkHEr%2Fuploads%2FFHU5k8LLctEcgs5uz1Rz%2Fimage.png?alt=media\&token=ea95690b-ee6e-49cb-9594-5b50c8e81ea0)
{% endhint %}

**Result:**

* With fewer than 10 items → validation message shown
* With 10 or more items → checkout allowed

***

### Supported Variables

You can mix and match variables across **Cart**, **Customer**, and **Line Item** levels when building conditions.

***

#### Cart Variables

Use these to validate the cart as a whole:

* **Cart attribute**
* **Cart has product**
* **Cart has variant**
* **Cart market**
* **Cart quantity**
* **Cart subtotal**
* **Retail location**

***

#### Customer Variables

Use these to apply rules based on who the customer is:

* **Customer company**
* **Customer ID**
* **Customer is B2B**
* **Customer logged in**
* **Customer tag**
* **Orders count**

***

#### Line Item Variables

Use these to apply rules based on specific products or variants:

* **Line attribute**
* **Line quantity**
* **Line subtotal**
* **Product collection**
* **Product ID**
* **Product tag**
* **Variant ID**
* **With selling plan**

***

### Combining Conditions (Advanced Logic)

You can build advanced validations such as:

* Cart quantity ≥ 10 **AND** Customer is logged in
* Customer is B2B **OR** Cart subtotal ≥ $500
* Product belongs to Collection X **AND** Variant has selling plan

This makes checkout validation extremely flexible for all use cases.

***

### Need Help?

If you have questions or need help setting up checkout validations:

* Use the in-app chat widget
* Email us at **<support@dollarlabs.io>**
