> ## Documentation Index
> Fetch the complete documentation index at: https://codebeans-cb-checkout-rules.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Character Count Limit

> Set a minimum and maximum length for checkout fields, or make a field required.

Many carriers cut off address lines that are too long, and very short values are often typos. This rule blocks checkout when a field's length is outside the range you set.

## How it works

You add one or more fields. For each field you set:

| Setting | Description |
| - | - |
| Minimum characters | The shortest value allowed. Leave empty for no minimum. |
| Maximum characters | The longest value allowed. Leave empty for no maximum. |
| Set field as required | Blocks checkout when the field is empty. |
| Validate in | For address fields: **Shipping address**, **Billing address**, or both. |
| Message to display | What the customer sees. English is required. |

If a field is empty and **Set field as required** is off, the field isn't checked. Spaces count as characters.

| Limits | Address line 1 | Result |
| - | - | - |
| Max 30 | `12 Main Street` | Allowed |
| Max 30 | `Flat 4, Building 12, Long Industrial Estate Road` | Blocked |
| Min 5 | `12` | Blocked |
| Min 5, not required | *(empty)* | Allowed |
| Min 5, required | *(empty)* | Blocked |

## Set up the rule

1. Click **Add validation to these fields** and tick the fields to check. Each field gets its own card.
2. In each card, set the limits, choose shipping or billing, and write the message.
3. To stop checking a field, click **Remove** in its card.

### Fields you can check

| Group | Fields |
| - | - |
| Contact | Contact email, Contact phone |
| Shipping / Billing address | City, Address line 1, Address line 2, Company, First name, Last name, Zip, Phone |
| Order | PO number |

## Show the limits in the message

Use `{{min_length}}` and `{{max_length}}` in your message. They are replaced with the numbers you set.

```text theme={null}
Address line 1 must be {{max_length}} characters or fewer, so it fits on the shipping label.
```

The customer sees: *Address line 1 must be 30 characters or fewer, so it fits on the shipping label.*

## Other settings

This rule has no country setting. It checks every order. It also has the **Rule status** and **Checkout behavior** settings described in [Common rule settings](https://codebeans-cb-checkout-rules.mintlify.site/rules/common-settings.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.