> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usecharlie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Understand how fulfillment constraints control which locations can fulfill orders

Fulfillment constraints are business rules that **block** locations from fulfilling specific orders. When a constraint applies, the affected locations are completely removed from consideration during checkout.

<Warning>
  Constraints are "hard" rules. If the only location with available stock is blocked by a constraint, the customer will see an error and no shipping options will appear at checkout.
</Warning>

## Constraints vs order routing

Charlie offers two ways to control where orders are fulfilled from:

|                   | Fulfillment constraints               | Order routing rules         |
| ----------------- | ------------------------------------- | --------------------------- |
| **Effect**        | Blocks locations entirely             | Deprioritizes locations     |
| **When no match** | Checkout blocked, no shipping options | Falls back to next priority |
| **Use case**      | Hard business requirements            | Optimization preferences    |

<Tip>
  Use constraints when a location **must not** fulfill certain orders under any circumstances. Use order routing when you **prefer** certain locations but can accept alternatives.
</Tip>

## How constraints work

When a customer reaches checkout, Charlie evaluates each constraint rule against the cart. For every rule that matches:

1. The specified locations are removed from the eligible fulfillment pool
2. Shopify then checks inventory only at remaining locations
3. If no remaining location has stock, checkout is blocked

```mermaid theme={"system"}
flowchart LR
    A[All locations] --> B{Constraint<br/>matches?}
    B -->|Yes| C[Remove from pool]
    B -->|No| D[Keep in pool]
    C --> E[Remaining locations]
    D --> E
    E --> F{Stock<br/>available?}
    F -->|Yes| G[Shipping options shown]
    F -->|No| H[Checkout blocked]
```

When checkout is blocked, customers see an error message indicating which items cannot be shipped:

<img src="https://mintcdn.com/charlie-6278c0d1/zIZXpEfAUH7cQkz5/images/constraints-checkout-error.png?fit=max&auto=format&n=zIZXpEfAUH7cQkz5&q=85&s=f963ad56a829a2ae97d84967efba178f" alt="Shopify checkout error when no shipping options are available" width="1086" height="452" data-path="images/constraints-checkout-error.png" />

## Constraint types

Charlie supports three types of constraints, each triggered by different conditions:

<CardGroup cols={3}>
  <Card title="Product rules" icon="box" href="/constraints/product-rules">
    Block locations based on **what** is in the cart (specific products or collections)
  </Card>

  <Card title="Customer rules" icon="user" href="/constraints/customer-rules">
    Block locations based on **who** is buying (B2B customers, customer tags)
  </Card>

  <Card title="Cart rules" icon="cart-shopping" href="/constraints/cart-rules">
    Block locations based on **cart properties** (total quantity, total amount, line item attributes)
  </Card>
</CardGroup>

## Filtering locations

Each constraint rule specifies which locations to block using one of these filters:

| Filter                 | Description                                 | Example                                   |
| ---------------------- | ------------------------------------------- | ----------------------------------------- |
| **Specific locations** | Block or allow only named locations         | "Block fulfillment from Paris Store"      |
| **Location tags**      | Block or allow locations by tag             | "Block all locations tagged `no-fragile`" |
| **Location type**      | Block or allow by type (Store or Warehouse) | "Block all Stores, allow only Warehouses" |

You can choose to either:

* **Exclude** matching locations (block them)
* **Include** only matching locations (block everything else)

<Info>
  Before using constraints, make sure your [locations are properly configured](/locations/overview) with the right types and tags.
</Info>

## Disabling all constraints

If you need to turn off all active constraints at once, go to **Charlie → Fulfillment constraints** and click **Disable all** at the top of the page.

A confirmation modal shows which rules will be affected:

* **Blocking rules** (safety stock, location capacity) switch to prioritize mode
* **Configurable rules** and **shipment limit** rules are removed

<Tip>
  This is useful for troubleshooting checkout issues or temporarily lifting all restrictions during peak periods.
</Tip>

## Use cases

### Bulky items from small stores

A fashion retailer sells oversized dresses that require large packaging. Their smaller retail locations don't have the storage space or packaging materials to ship these items.

**Setup:**

* Constraint type: Product rule
* Condition: Cart contains products from the "Bulky Dresses" collection
* Filter: Exclude locations tagged `small-store`

**Result:**

* Regular items → All locations eligible
* Bulky dresses → Only large stores and warehouses can fulfill
* If only a small store has a bulky dress in stock → Checkout blocked

### High-value orders from warehouse only

A luxury brand wants to ensure that high-value orders (over €500) are only fulfilled from their central warehouse where they have dedicated packaging and insurance processes.

**Setup:**

* Constraint type: Cart rule
* Condition: Total amount > €500
* Filter: Include only locations tagged `central-warehouse`

**Result:**

* Orders under €500 → All locations eligible
* Orders over €500 → Only the central warehouse can fulfill
* If central warehouse is out of stock on a €600 order → Checkout blocked

### B2B orders from dedicated locations

A wholesaler needs to ensure B2B customers are only served from locations with proper invoicing and bulk packaging capabilities.

**Setup:**

* Constraint type: Customer rule
* Condition: Customer is B2B
* Filter: Include only locations tagged `b2b-enabled`

**Result:**

* Regular customers → All locations eligible
* B2B customers → Only B2B-enabled locations can fulfill
* If no B2B location has stock → Checkout blocked
