Build a preorder offer from a description
Worked recipe: describe a preorder offer in plain words, have plan_offer turn it into the ordered API calls, run them, and verify the offer and its selling plan. Every call, a worked plan, and how to check it.
Last updated
For: merchants and agencies who describe an offer in words (“a 30% deposit, the rest when it ships, ships 1 March, two per order”) and want an AI agent to build it correctly the first time.
Goal: a preorder offer with the right variants, deposit, balance, ship date and limits, created in the safe order, switched on last, and checked against the selling plan Shopify holds.
plan_offer only plans. It reads no store data and creates nothing. It returns the calls that build the offer, already ordered and checked against the API, and you run them.
Before you start
Section titled “Before you start”- Credentials: an MCP client signed in to the store with OAuth (see MCP), or the store’s API key.
- Variant ids: find them first with a product search; don’t guess them. Shopify admin URLs carry the numeric id, and
plan_offeraccepts it for collections and markets. - Questions first: if the request leaves out something the offer can’t do without (which products, how big the deposit, which ship date), ask the merchant before you call
plan_offer. - What the API can’t do: a limit per customer across orders, and a cap on total units sold for the whole offer. The plan’s
warningssay so; tell the merchant, and don’t promise them.
1. Describe the offer
Section titled “1. Describe the offer”{ "tool": "plan_offer", "arguments": { "offer": { "name": "Winter Drop", "products": { "variant_ids": ["gid://shopify/ProductVariant/43900910010503", "gid://shopify/ProductVariant/43900910043271"] }, "payment": { "mode": "partial", "deposit_percent": 30, "balance_on_fulfillment": true }, "shipping": { "delivery": "date", "date": "2027-03-01", "text": "Ships 1 March" }, "limits": { "max_per_order": 2 }, "launch": { "enable": true } } }}Every section is optional; leave out what the merchant didn’t ask for, including inventory. Add inventory.continue_selling: true only when the merchant has sold-out variants and agrees, because it changes Shopify’s inventory policy for the attached variants. The sections are products, inventory, payment (including discount), shipping, limits, markets, widget, checkout, schedule, launch and batches. A request the API can’t build, such as payment.mode: "full" with a deposit, comes back as an error that names the field. Fix it and call again.
2. Read the plan
Section titled “2. Read the plan”{ "summary": "10 calls build \"Winter Drop\". Run them in order with execute_write / execute_read …", "steps": [ { "step": 1, "tool": "execute_write", "arguments": { "method": "POST", "path": "/preorders/offers", "params": { "name": "Winter Drop" } }, "purpose": "Create the offer. Its id replaces :id in every later step." }, { "step": 2, "tool": "execute_write", "arguments": { "method": "POST", "path": "/preorders/offers/:id/disable" }, "purpose": "Pause the new offer (offers are live as soon as they are created) while it is set up." }, "…" ], "warnings": ["inventory.continue_selling changes Shopify's inventory policy of the attached variants …", "limits.max_per_order caps one order only: a customer can place several orders."], "unsupported": [], "script": "#!/usr/bin/env bash …"}Read warnings and unsupported to the merchant before you run anything. The order is fixed by the tool: a new offer is live the moment it exists, so it is paused straight after it is created, and it is turned on last; inventory rules go in before variants are attached; the payment options come before the deposit and balance; attaching variants runs as a background job, so the plan waits for it before turning the offer on. script is the same plan as a curl script for the store’s API key.
3. Run the steps in order
Section titled “3. Run the steps in order”Run each step with the tool and arguments the plan gives, adding a fresh idempotency_key to each write. Replace :id with the id the first step returns, and :job_id with the job.job_id the product step returns. For this offer the plan’s calls are:
{ "tool": "execute_write", "arguments": { "method": "POST", "path": "/preorders/offers", "params": { "name": "Winter Drop" }, "idempotency_key": "<new uuid>" } }{ "tool": "execute_write", "arguments": { "method": "POST", "path": "/preorders/offers/<offer_id>/disable", "idempotency_key": "<new uuid>" } }{ "tool": "execute_write", "arguments": { "method": "POST", "path": "/preorders/offers/<offer_id>/products/add_variants", "params": { "shopify_variant_ids": ["gid://shopify/ProductVariant/43900910010503", "gid://shopify/ProductVariant/43900910043271"] }, "idempotency_key": "<new uuid>" } }{ "tool": "execute_write", "arguments": { "method": "PATCH", "path": "/preorders/offers/<offer_id>/payments", "params": { "options_offered": "partial" }, "idempotency_key": "<new uuid>" } }{ "tool": "execute_write", "arguments": { "method": "PATCH", "path": "/preorders/offers/<offer_id>/payments", "params": { "partial": { "checkout_charge": { "charge_type": "percentage", "charge_amount": 30 } }, "collection_schedule": "on_fulfillment" }, "idempotency_key": "<new uuid>" } }{ "tool": "execute_write", "arguments": { "method": "PATCH", "path": "/preorders/offers/<offer_id>/shipping", "params": { "ships_at": "2027-03-01", "timeline": { "show_shipping_text": true, "shipping_text": "Ships 1 March" } }, "idempotency_key": "<new uuid>" } }{ "tool": "execute_write", "arguments": { "method": "PATCH", "path": "/preorders/offers/<offer_id>/limits", "params": { "order_quantity": { "maximum": 2 } }, "idempotency_key": "<new uuid>" } }Then wait for the attach job, and only when its status is completed turn the offer on. If it is failed, stop and tell the merchant.
{ "tool": "execute_read", "arguments": { "method": "GET", "path": "/preorders/product_variants/jobs/<job_id>" } }{ "tool": "execute_write", "arguments": { "method": "POST", "path": "/preorders/offers/<offer_id>/enable", "idempotency_key": "<new uuid>" } }A 409 with preflight_issues on the product step means some variants are on another offer or can’t take preorders as they are. Ask the merchant which fix they want, then resend with the resolve keys (see step 3 of Launch a preorder offer from a product list). A schedule start turns the offer on by itself, so the plan leaves enable out and says so in its warnings.
4. Read the offer back
Section titled “4. Read the offer back”{ "tool": "execute_read", "arguments": { "method": "GET", "path": "/preorders/offers/<offer_id>" } }This is the plan’s last step, and part of the job: run it, compare the offer with what the merchant asked for, and report what you read. Don’t say the offer is built before you have read it back.
If it fails
Section titled “If it fails”| Code | What happened | What to do |
|---|---|---|
auth_, auth_ |
No credential, or not a current one | Reconnect the MCP client or send the store’s API key |
invalid_ |
A field failed the schema | Fix the field named in details[]. and resend that step |
preflight_ |
Some variants can’t be added as they are | Ask the merchant, then resend with the resolve keys |
plan_ |
A deposit, schedule, batches or collection selection needs a paid plan; that step saved nothing | Tell the merchant; leave the paid part out or ask them to upgrade |
conflict |
The attach job is still running, or the offer’s state doesn’t allow the step | Wait for the job, then retry the step |
rate_ |
The key used its points for this minute | Wait retry_ seconds |
If a run stops partway, read the offer (step 4) before you retry. It stays paused until the last step, so a half-built offer is never live.
Check it worked
Section titled “Check it worked”-
Read the offer:
availability.current_statusislive(oroffif the merchant asked to review first), the deposit is 30%,shipping.ships_atis 2027-03-01 and the per-order maximum is 2. -
List its variants and compare the count with the list you sent:
{ "tool": "execute_read", "arguments": { "method": "GET", "path": "/preorders/offers/<offer_id>/products/variants", "params": { "per_page": 100 } } } -
Verify the selling plan: ask how a shopper sees one of the variants.
status: "live"means the offer applies to it:{ "tool": "execute_read", "arguments": { "method": "GET", "path": "/preorders/product_variants/availability", "params": { "country": "US", "shopify_variant_ids": "43900910010503" } } }STOQ publishes the offer to Shopify as a selling plan in the background, so allow a minute. The storefront data on the variant (see Preorder badge, button and notify-me on a headless storefront) then lists the selling plan with the deposit and the ship date.
-
Tell the merchant what the plan’s warnings said, in particular that
max_per_orderlimits one order, not a customer.
Thanks for letting us know.
Still stuck? Ask Quinn or chat with support