# Conditions

### Understanding Conditions

Conditions determine when a rule should activate. You can combine multiple conditions using AND/OR logic to create sophisticated rules.

{% hint style="info" %}
**Condition Logic**

Within a condition group, ALL conditions must be true (AND logic).

Between condition groups, ANY group can be true (OR logic).
{% endhint %}

### Available Conditions

<details>

<summary><strong>User Role</strong></summary>

Target specific user roles like customers, subscribers, or custom roles.

#### Operators:

* **is** - User has this role
* **is not** - User doesn't have this role

{% hint style="info" %}

#### **Example:**

User Role **is** Guest (not logged in)
{% endhint %}

</details>

<details>

<summary><strong>Session Status</strong></summary>

Check if user is logged in or not.

**Operators:**

* **is** - Session status matches
* **is not** - Session status doesn't match

{% hint style="info" %}

#### Values:

* Logged In
* Logged Out
  {% endhint %}

</details>

<details>

<summary><strong>Product Price</strong></summary>

Check product price (useful for variable products).

**Operators:**

* Equal to
* Not equal to
* Greater than or equal to
* Less than or equal to

{% hint style="info" %}
**Example:**

Product Price **Greater than or equal to** 100
{% endhint %}

</details>

<details>

<summary><strong>Product On Sale</strong></summary>

Check if product is currently on sale.

**Operators:**

* **is** - Product is on sale
* **is not** - Product is not on sale

{% hint style="info" %}
**Values:**

* Yes
* No
  {% endhint %}

</details>

<details>

<summary><strong>Product Stock Status</strong></summary>

Check product stock availability.

**Operators:**

* **is** - Stock status matches
* **is not** - Stock status doesn't match

{% hint style="info" %}
**Values:**

* In Stock
* Out of Stock
* On Backorder
  {% endhint %}

</details>

<details>

<summary><strong>Cart Total</strong></summary>

Check the total value of items in cart.

**Operators:**

* Equal to
* Not equal to
* Greater than or equal to
* Less than or equal to

{% hint style="info" %}
**Example:**

Cart Total **Less than or equal to** 50
{% endhint %}

</details>

<details>

<summary><strong>Cart Subtotal</strong></summary>

Check cart subtotal (before taxes and shipping).

**Operators:**

* Equal to
* Not equal to
* Greater than or equal to
* Less than or equal to

</details>

<details>

<summary><strong>Cart Quantity</strong></summary>

Check total number of items in cart.

**Operators:**

* Equal to
* Not equal to
* Greater than or equal to
* Less than or equal to

</details>

<details>

<summary><strong>Cart Contains Product</strong></summary>

Check if specific product is in cart.

**Operators:**

* contains - Cart has this product
* does not contain - Cart doesn't have this product

</details>

<details>

<summary><strong>Cart Contains Category</strong></summary>

Check if products from specific category are in cart.

**Operators:**

* contains - Cart has products from this category
* does not contain - Cart doesn't have products from this category

</details>

<details>

<summary><strong>Country</strong></summary>

Target users from specific countries (based on billing/shipping address or IP).

**Operators:**

* is - User is from this country\
  is not - User is not from this country

</details>

<details>

<summary><strong>Time</strong></summary>

Check current time for daily recurring time windows (business hours, flash sales).

**Operators:**

* **is** - Current time is exactly this time
* **is not** - Current time is not this time
* **is before or at** - Current time is before or equal to this time
* **is after or at** - Current time is after or equal to this time

{% hint style="info" %}
**Example:**

Time is after or at 09:00 AND Time is before or at 17:00

*Result: Rule active during business hours (9 AM - 5 PM) every day*
{% endhint %}

</details>

<details>

<summary><strong>Date/Time</strong></summary>

Check specific date and time for one-time events (product launches, deadlines, limited offers).

**Operators:**

* **is** - Current time is exactly this time
* **is not** - Current time is not this time
* **is before or at** - Current time is before or equal to this time
* **is after or at** - Current time is after or equal to this time

{% hint style="info" %}
**Example:**

Date/Time is after or on 2024-12-25 00:00

*Result: Product becomes available at midnight on Christmas*
{% endhint %}

</details>

### Combining Conditions

#### AND Logic (Within a Group)

All conditions in a group must be true for the rule to activate.

{% hint style="info" %}
**Example: Hide button for guests on expensive products**

`Condition 1: Session Status is Logged Out`

`AND`

`Condition 2: Product Price Greater than or equal to 100`

Both conditions must be true for the rule to activate.
{% endhint %}

#### OR Logic (Between Groups)

Click "Add Condition Group" to create alternative conditions. If ANY group matches, the rule activates.

{% hint style="info" %}
**Example: Hide button for guests OR wholesale customers**

`Group 1: Session Status is Logged Out`

`OR`

`Group 2: User Role is Wholesale Customer`

If either group is true, the rule activates.
{% endhint %}

{% hint style="info" %}
**Pro Tip**

Start with simple conditions and test them. Then add more conditions to refine your rules.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.condicart.com/core-features/conditions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
