LexQLexQ

Playground

Run LexQ's domain templates on the real decision engine. Pick a sample, change any input, and see which rule decides and why. No signup needed.

One order discount per order (member tier or first-order code), a capped AI-proposed discount on top of it, free shipping, and 5% member rewards.

Pick a sample

WELCOME15 takes 15% off the $64 subtotal. The free-shipping rule checks the $64 in the request, not the discounted $54.40. The code's $50 minimum keeps both above $35.

Adjust the inputs

purchaseSubtotalUsd
Allowed range: ≥ 0

Merchandise subtotal before discounts, tax, and shipping, in USD. Exclude gift cards. The order discount is applied to this value.

loyaltyTier

Customer loyalty tier: NONE (guest), BRONZE, SILVER, GOLD, PLATINUM.

appliedPromoCode

Promo code entered at checkout. Send it in upper case with spaces removed: the rules match codes exactly. Send an empty string when none.

First PurchaseisFirstPurchase

Whether this is the customer's first order. Check past orders by account, email, payment card, and shipping address.

customerLtvUsd
Allowed range: ≥ 0

Total the customer has paid, minus refunds and cancellations, in USD. Send 0 for a guest: with null, the 10% AI cap for customers under $1,000 does not apply.

cartCategoryTags

Category tags of items in the cart (e.g., apparel, electronics, gift_card). The rules match tags exactly: send electronics in lower case, or the 5% AI cap for electronics does not apply.

loyaltyCreditUsd
Allowed range: ≥ 0

Send 0. The rewards rule writes the credit this order earns, in USD. Add it to the customer's balance once the return window closes.

aiSuggestedDiscountPercent
Allowed range: 0–100

Extra discount the AI shopping assistant proposed, 0 to 100. Send 0 when there is none. The rules may lower it: read the result from mutatedFacts, and if the key is not there, use the percent you sent. LexQ does not apply it to the price. Take it off the subtotal after the order discount. The discounts compound, so the largest total discount is 27.75% (PLATINUM 15%, then AI 15% of the rest). Gift cards are never discounted.

Result

Run the engine to see the decision here.

The rules below then show which ones matched, which were selected, and which lost.

Rules

10 rules

Each rule checks its condition against the inputs. Matching rules apply in priority order, #1 first.

ecom_order_discountMutex group: only the highest-priority match applies
  1. 1PLATINUM member: 15% offAlways-on member price for the top tier. Does not stack with other order discounts.
  2. 2WELCOME15: 15% off first order ($50+)Welcome code for a first order of $50 or more. No effect on repeat orders.
  3. 3GOLD member: 10% offAlways-on member price for GOLD.
  4. 4SILVER member: 5% offAlways-on member price for SILVER.

No mutex group: every matching rule applies

  1. 5Free shipping: members or $35+Members always ship free. Guests need a $35 merchandise subtotal.
  2. 6Member rewards: 5% backCredit is 5% of the subtotal after the order discount, before any AI-proposed discount.
ecom_ai_offer_capMutex group: only the highest-priority match applies
  1. 7AI offer cap: 5% on electronicsElectronics carry low margins, so carts that include them get at most 5% from the AI assistant.
  2. 8AI offer cap: 10% under $1,000 lifetime spendCustomers with less than $1,000 lifetime spend get at most 10%.
  3. 9AI offer ceiling: 15%Caps the AI offer at 15%. It stacks on any order discount.

No mutex group: every matching rule applies

  1. 10Flag AI offers above 30% for reviewA person checks offers above 30%. The cap still applies.
Conditions, actions, and sample math in the docs

What changes when a rule changes

LexQ's Impact Simulation runs the same requests through your current rules and an edited draft, so you can see how the results change before you deploy. Here, we ran 200 requests ahead of time through two drafts, each with one threshold changed.

What this draft changes

The 10% cap on AI offers now covers only customers under $500 in lifetime spend, down from $1,000. Offers to customers who have spent $500 to $999 are no longer capped by this rule.

This draft affects 10 of 200 requests.

  • 10 requestsBeforeAfterAI-Suggested Discount (%)Overwritten by a ruleBefore: 10After: 15Rules fired in one version onlyBefore: AI offer cap: 10% under $1,000 lifetime spendAfter: AI offer ceiling: 15%

    Inputs

    • #8

      Lifetime Spend (USD)
      605
      AI-Suggested Discount (%)
      42
    • #27

      Lifetime Spend (USD)
      522
      AI-Suggested Discount (%)
      59
    • #44

      Lifetime Spend (USD)
      601
      AI-Suggested Discount (%)
      48

Run the same comparison on your own rules and requests.

Start Free

Computed in advance with LexQ's Dry Run Compare, which runs two versions on the same input and compares the results, one request at a time. Impact Simulation makes the same comparison across many requests at once and reports aggregate metrics. This section does not call the engine. The requests are generated within fixed input ranges, not taken from real traffic. Each group lists only the rules that fired in one version but not the other, and only the inputs those rules check. Loading a request fills in all of its inputs.

Show the input ranges
purchaseSubtotalUsd
10.19–399.83
loyaltyTier
NONE 80, SILVER 36, BRONZE 33, GOLD 32, PLATINUM 19
appliedPromoCode
"" 180, WELCOME15 20
isFirstPurchase
true 28, false 172
customerLtvUsd
0–4,894
cartCategoryTags
beauty 68, accessories 64, apparel 56, home 50, electronics 44
loyaltyCreditUsd
0–0
aiSuggestedDiscountPercent
0–60