> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://molsoft.crisp.help/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Enforce credit limits in your online store

**Where:** Your online store (theme) + checkout **Who:** You set it up once; your B2B buyers experience it automatically **Requires:** the **Credit** plan (or higher)

This protects your credit exposure on the web: when a B2B buyer's order would push their company **over its credit limit on net terms**, checkout is **blocked** with a clear message. Pay‑in‑full orders are never affected.

It has **two parts that both need to be turned on**:

1. The **OnAccount credit terms** theme app embed — works out whether the signed‑in buyer is on net terms and what deposit applies, and quietly tags the cart with that information.
2. The **credit-limit-validation** checkout rule — reads those cart tags plus your credit limits and blocks checkout if the order goes over.

> If only the checkout rule is on without the embed, it has nothing to act on and every order passes. **Turn on both.**

---

## What your buyer experiences

**The first time** a buyer signs in and returns to the storefront, it's normal to see a brief **"Validating session…"** message and the page refresh once. That's expected: OnAccount is obtaining **Customer Account API** access to read the buyer's **net‑terms and deposit rules** so it can enforce the limit. It happens once per session and is silent afterward.

For a signed‑in B2B buyer on net terms, when their cart would exceed the company's (or location's) available credit, checkout is blocked with a message in their currency, for example:

> *This order adds 800.00 USD on net terms, which puts your account 300.00 USD over its 5,000.00 USD credit limit (current balance 4,500.00 USD). Please reduce the order or contact us to proceed.*

Buyers who are **paying in full**, or who aren't B2B, check out normally. If anything goes wrong behind the scenes, the feature **fails safe** and lets checkout proceed rather than blocking a legitimate order.


![](https://storage.crisp.chat/users/helpdesk/website/-/4/d/d/3/4dd3899948d8e000/image_1yhgn8y.png)
*An over‑limit message shown at checkout for a B2B buyer.*
---

## Set it up

### Step 1 — Set your credit limits first

Enforcement needs limits to enforce. Do [Managing credit limits](https://molsoft.crisp.help/en/article/managing-credit-limits-xyg6co/) before this.

### Step 2 — Turn on the theme app embed

This is **required** for the checkout rule to enforce limits correctly.

1. Shopify admin → **Online Store → Themes → Customize** on your live theme.
2. In the theme editor, click **App embeds** (the puzzle‑piece icon in the left sidebar).
3. **Activate** the **OnAccount credit terms** app embed.
4. Make sure to click **Save**.

The embed is invisible to shoppers — it only tags the cart. It does nothing for ordinary (non‑B2B) shoppers.


![](https://storage.crisp.chat/users/helpdesk/website/-/4/d/d/3/4dd3899948d8e000/image_dn6ssp.png)
*The App embeds panel in the theme editor with "OnAccount credit terms" activated.*
### Step 3 — Add the checkout rule

1. In Shopify admin, go to your **Checkout settings** (**Settings → Checkout**).
2. Locate the **Checkout rules** section and click **Add rule**.
3. Select the **credit-limit-validation** rule.
4. Give the rule a **name**, set its **status** to **Active**, and save.

> Optional: in the rule's settings you can choose whether checkout is **blocked** when the rule can't run — blocking is the safer choice for credit control.


![](https://storage.crisp.chat/users/helpdesk/website/-/4/d/d/3/4dd3899948d8e000/image_lpgdas.png)
*The empty Checkout rules section.*


![](https://storage.crisp.chat/users/helpdesk/website/-/4/d/d/3/4dd3899948d8e000/image_7qdiix.png)
*T*
*he checkout rules selection modal.*


![](https://storage.crisp.chat/users/helpdesk/website/-/4/d/d/3/4dd3899948d8e000/image_ww2gjc.png)
*The checkout rule save page.*

### Step 4 — Check the buyer sign‑in flow

The embed needs the buyer to be **signed in** so it can read their net‑terms setup. The first time it runs, the buyer may briefly see a "Validating session…" overlay — that's expected and only happens once. After that, enforcement is silent.

---

## Test it quickly

1. Set one company's limit low (say, 100) and note its current balance.
2. Sign in to your online store **as a B2B buyer for that company**, on net terms.
3. Add items that exceed the available credit and go to checkout → it should be **blocked** with the over‑limit message.
4. Reduce the cart back under the limit → checkout proceeds.
5. Switch the buyer's location to **pay in full** → checkout proceeds regardless of amount.

---

## Troubleshooting

| What you see | What it usually means |
| ---- |
| Over‑limit orders **aren't blocked** | The theme embed is off, or the buyer isn't recognized as a signed‑in B2B buyer. Confirm the embed is on and the buyer is logged in to their company account. |
| **Every** B2B order is blocked unexpectedly | Limits may be set too low, or the company's balance looks too high. Re‑check the limit and the outstanding balance. |
| Buyer sees a **"Validating session…" loop** | The browser may be blocking cookies/storage, or the sign‑in setup needs attention. The feature should give up after one attempt and let checkout through. |