Skip to content

Storefront data contract

The STOQ metafields and metaobjects you can build on without STOQ's JavaScript, which fields are stable, and how to read a variant's preorder offer from Liquid or the Storefront API.

Last updated

STOQ publishes each preorder offer to Shopify as a metaobject, and points every variant in the offer at it. A theme, a headless storefront, another app or an AI agent can read them to build its own preorder UI, without loading STOQ’s widget.

This page is the contract for that data:

  • Stable fields keep their name, type and meaning. A change to one ships only as a new contract version, announced in the Changelog below.
  • Internal fields are published for STOQ’s own widget. They may change or disappear without notice. Don’t build on them.
  • New fields and new enum values can be added at any time without a new version. Ignore keys you don’t know, and treat an unknown enum value as “not supported”.

STOQ’s metafields and metaobjects are app-owned: only STOQ can write them, and merchants and other apps can read them. Outside STOQ’s own code, use the full namespace, which includes STOQ’s app ID (5940125):

Where you read it Variant offer metafield Offer metaobject type
Theme Liquid (your theme code) variant.metafields['app--5940125'].offer app--5940125--offer
Storefront API (headless, Hydrogen, other apps) metafield(namespace: "app--5940125", key: "offer") app--5940125--offer
STOQ’s own code $app.offer $app:offer

A variant has one offer metafield: a list of references to the offers it belongs to. An empty list means the variant isn’t in any preorder offer. Being in an offer isn’t the same as being on preorder right now: check current_status (live), and the offer’s inventory.stock_condition against the variant’s stock.

Inside a product form:

{%- assign variant = product.selected_or_first_available_variant -%}
{%- assign market_gid = 'gid://shopify/Market/' | append: localization.market.id -%}
{%- assign offers = variant.metafields['app--5940125'].offer.value -%}
{%- for offer in offers -%}
{%- assign stock = offer.inventory.value.stock_condition -%}
{%- assign in_stock = false -%}
{%- if variant.inventory_management == blank or variant.inventory_quantity > 0 -%}{%- assign in_stock = true -%}{%- endif -%}
{%- assign eligible = false -%}
{%- if stock == 'any_stock_level' -%}{%- assign eligible = true -%}
{%- elsif stock == 'out_of_stock' and in_stock == false -%}{%- assign eligible = true -%}
{%- elsif stock == 'in_stock' and in_stock -%}{%- assign eligible = true -%}
{%- endif -%}
{%- assign markets = offer.markets.value -%}
{%- if markets.scope == 'selected' -%}
{%- unless markets.shopify_market_ids contains market_gid -%}{%- assign eligible = false -%}{%- endunless -%}
{%- endif -%}
{%- if offer.current_status.value == 'live' and eligible -%}
{%- assign widget = offer.widget.value -%}
{%- assign shipping = offer.shipping.value -%}
{%- assign payments = offer.payments.value -%}
{%- assign plan_gid = payments[payments.default_option].selling_plan_id -%}
{%- if offer.advanced.value.checkout_method == 'selling_plan' and plan_gid -%}
<input type="hidden" name="selling_plan" value="{{ plan_gid | split: '/' | last }}">
{%- endif -%}
<button type="submit" name="add">{{ widget.button.button_text | default: 'Preorder' | escape }}</button>
{%- if shipping.timeline.show_shipping_text -%}
<p>{{ shipping.timeline.shipping_text | escape }}</p>
{%- endif -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}

The example skips an offer whose markets.scope is selected and does not list the shopper’s current market, so a Canada-only offer listed first doesn’t win for a US shopper. It takes the first eligible offer. If a variant has both a market-specific offer and an unrestricted one, check the market-specific offer first, as STOQ’s own widget does.

Liquid renders once, when the page loads. If your theme changes the selected variant without reloading the page, recompute the offer and the selling_plan input on each variant change (for example by re-rendering this block through the Section Rendering API), or use this example only on forms with a fixed variant. Keep the variant id and the selling_plan value in step before the form submits: a plan from one variant sent with another variant’s ID doesn’t apply.

The selling_plan input adds the variant on the offer’s payment terms: the plan of payments.default_option, sent as the number at the end of its GID. An offer whose advanced.checkout_method is line_item_property has no plan to send: that mode depends on STOQ’s own widget adding line item properties, so build custom UI on selling_plan offers.

Inside the same {%- if offer.current_status.value == 'live' and eligible -%} block, after payments and shipping are assigned:

{%- assign deposit = payments.partial.checkout_charge -%}
{%- if deposit and payments.partial.selling_plan_id -%}
{%- if deposit.charge_type == 'percentage' -%}
<p>{{ deposit.charge_amount }}% due today</p>
{%- else -%}
<p>{{ deposit.charge_amount }} {{ payments.currency_code | escape }} due today</p>
{%- endif -%}
{%- endif -%}
{%- if shipping.delivery_timing == 'exact_time' and shipping.ships_at -%}
<p>Ships {{ shipping.ships_at | date: '%B %-d, %Y' }}</p>
{%- elsif shipping.days_after_checkout -%}
<p>Ships {{ shipping.days_after_checkout }} days after checkout</p>
{%- elsif shipping.timeline.show_shipping_text -%}
<p>{{ shipping.timeline.shipping_text | escape }}</p>
{%- endif -%}

payments.partial is missing on an offer that only takes full payment, so the deposit lines are skipped there. A full-payment offer has no deposit: the shopper pays everything at checkout. charge_amount is a plain number, not formatted money.

query VariantPreorderOffer($variantId: ID!) {
node(id: $variantId) {
... on ProductVariant {
offers: metafield(namespace: "app--5940125", key: "offer") {
references(first: 5) {
nodes {
... on Metaobject {
offerId: field(key: "offer_id") { value }
name: field(key: "name") { value }
status: field(key: "current_status") { value }
widget: field(key: "widget") { value }
shipping: field(key: "shipping") { value }
payments: field(key: "payments") { value }
}
}
}
}
}
}
}

The json fields come back as JSON strings: parse widget.value, shipping.value and the rest before reading their keys.

Every selling plan an offer owns also points at the offer metaobject, so you can read the offer from a cart line or a selling plan allocation too:

query PlanOffer($variantId: ID!) {
node(id: $variantId) {
... on ProductVariant {
sellingPlanAllocations(first: 5) {
nodes {
sellingPlan {
id
offer: metafield(namespace: "app--5940125", key: "offer") {
reference { ... on Metaobject { status: field(key: "current_status") { value } } }
}
}
}
}
}
}
}
query Offers {
metaobjects(type: "app--5940125--offer", first: 50) {
nodes {
handle
name: field(key: "name") { value }
status: field(key: "current_status") { value }
}
}
}
  • The offer metaobject is rewritten shortly after the offer is saved in STOQ (dashboard, API or MCP). An unchanged offer isn’t rewritten.
  • A scheduled offer is checked every 5 minutes: when it goes live or ends, current_status and availability are rewritten.
  • Variant offer references are rewritten when variants join or leave the offer. Large offers are written in batches, so the last variants can take a few minutes.
  • A deleted offer’s selling plans and variants stop pointing at it first; its metaobject is deleted after that.

Handle: offer-<offer_id>. One entry for each offer that hasn’t been deleted.

Field Type Meaning Stability
offer_id single_line_text_field STOQ’s offer ID (a UUID). The ID the STOQ API and MCP use. Stable
name single_line_text_field The offer name shoppers see. Stable
current_status single_line_text_field live, off, scheduled or deleted. Same as availability.current_status. A deleted offer’s entry is removed, so deleted is rarely seen. Stable
widget json Button, disclaimer and badge display settings. Stable
inventory json When a variant in the offer can be preordered. Stable
shipping json Shipping text and delivery timing. Stable
payments json Payment options and their selling plans. Stable
availability json Schedule and current status. Stable
limits json Quantity limits, terms and cart rules. Stable
countdown json Countdown timer settings. Stable
markets json Which markets the offer sells in. Stable
advanced json Checkout method and cart attributes. Stable
integrations json B2B. Stable
batches json Batch (wave) settings and the batches. Stable
translations json Translated text by locale. Stable

Types: string, boolean, integer, number, timestamp (ISO 8601, UTC), gid(Type) (a Shopify GID) and enum(a\|b). A trailing ? means the value can be null. <option> is full or partial; [] is each item of a list.

widget

Key Type Meaning Stability
widget.button.button_text string? Preorder button label. Stable
widget.button.custom_colors_enabled boolean? Use the colors below instead of the theme’s. Stable
widget.button.text_color string? Button text color (hex). Stable
widget.button.background_color string? Button background color (hex). Stable
widget.disclaimer.show_disclaimer boolean Show the message under the button. Stable
widget.disclaimer.disclaimer_text string? That message. Stable
widget.disclaimer.text_color string? Its text color. Stable
widget.disclaimer.background_color string? Its background color. Stable
widget.disclaimer.border_radius integer? Its corner radius, in px. Stable
widget.badge.show_badge boolean? Show a preorder badge on the product. Stable
widget.badge.badge_text string? Badge text. Stable
widget.badge.text_color string? Badge text color. Stable
widget.badge.background_color string? Badge background color. Stable

inventory

Key Type Meaning Stability
inventory.stock_condition enum(out_of_stock|in_stock|any_stock_level) When a variant in the offer is sold as a preorder: only when out of stock, only while in stock, or at any stock level. Stable

shipping

Key Type Meaning Stability
shipping.timeline.scope enum(same|per_variant) One shipping text for every variant, or a text per variant. Stable
shipping.timeline.show_shipping_text boolean? Show the shipping text with the button. Stable
shipping.timeline.shipping_text string? The offer’s shipping text. Stable
shipping.timeline.variant_shipping_text string? A variant’s text when it has none of its own. Stable
shipping.delivery_timing enum(asap|exact_time|unknown) How the ship date is set. Stable
shipping.ships_at timestamp? Fixed ship date, when there is one. Stable
shipping.days_after_checkout integer? Ships this many days after checkout, when set. Stable

payments

Key Type Meaning Stability
payments.options_offered enum(full|partial|full_and_partial) Which payment options shoppers can choose. Stable
payments.default_option enum(full|partial) The option selected first. Stable
payments.<option>.selling_plan_id gid(SellingPlan)? The selling plan to add to the cart for this option. Stable
payments.<option>.checkout_charge.charge_type enum(percentage|price) How the amount paid at checkout is set. Stable
payments.<option>.checkout_charge.charge_amount number? The percentage or amount paid at checkout (full is always 100%). Stable
payments.<option>.price_adjustment.adjustment_type enum(percentage|price|fixed_amount)? Discount type, or null for no discount. Stable
payments.<option>.price_adjustment.adjustment_amount number? Discount value. Stable
payments.<option>.option_title string? Option label in the payment picker. Stable
payments.<option>.option_description string? Option description. Stable
payments.<option>.discount_text string? Discount label. Stable
payments.show_payment_widget boolean? Show the payment option picker. Stable
payments.show_discounted_price boolean? Show the discounted price on the product page. Stable
payments.currency_code string? Shop currency for the amounts above. Stable

payments.full and payments.partial are present only for an option the offer offers (see payments.options_offered), and selling_plan_id is null until STOQ has created the plan. checkout_charge is what the shopper pays at checkout: a deposit is partial with charge_type percentage (charge_amount is the percent) or price (the amount, in payments.currency_code). The balance is charged later.

availability

Key Type Meaning Stability
availability.schedule enum(enabled|disabled|date_range|starts_on|ends_on) Whether the offer is switched on by hand or follows dates. Stable
availability.starts_at timestamp? Scheduled start. Stable
availability.ends_at timestamp? Scheduled end. Stable
availability.current_status enum(live|off|scheduled|deleted) Status when last published. Stable

limits

Key Type Meaning Stability
limits.display_style enum(progress_bar|disclaimer|none) How a quantity limit is shown. Stable
limits.limit_text string? Limit message. Stable
limits.show_icons boolean? Show icons in the disclaimer. Stable
limits.progress_bar.progress_text string? Progress bar text. Stable
limits.progress_bar.fill_color string? Bar fill color. Stable
limits.progress_bar.background_color string? Bar background color. Stable
limits.progress_bar.box_background_color string? Box background color. Stable
limits.progress_bar.text_color string? Text color. Stable
limits.progress_bar.border_radius integer? Corner radius, in px. Stable
limits.progress_bar.show_percentage boolean? Show the percentage sold. Stable
limits.terms.require_acceptance boolean? Shoppers must accept terms before buying. Stable
limits.terms.terms_text string? The terms. Stable
limits.terms.disable_button_until_accepted boolean? Keep the button disabled until they accept. Stable
limits.terms.record_acceptance boolean Save the acceptance as a line item property. Stable
limits.terms.acceptance_label string? That property’s name. Stable
limits.cart.allowed_items enum(mixed|preorder_only) Whether preorder and in-stock items can share a cart. Stable
limits.cart.error_message string? Message when they can’t. Stable
limits.order_quantity.minimum integer? Minimum quantity per order. Stable
limits.order_quantity.maximum integer? Maximum quantity per order. Stable

countdown

Key Type Meaning Stability
countdown.show_when enum(disabled|before_launch|during_preorder|both) When the timer shows. Stable
countdown.date_source enum(schedule|custom) Count to the offer’s schedule or to the dates below. Stable
countdown.starts_at timestamp? Custom start. Stable
countdown.ends_at timestamp? Custom end. Stable
countdown.starts_text string? Heading before launch. Stable
countdown.ends_text string? Heading while the preorder runs. Stable
countdown.labels.days string? Unit label. Stable
countdown.labels.hours string? Unit label. Stable
countdown.labels.minutes string? Unit label. Stable
countdown.labels.seconds string? Unit label. Stable
countdown.text_color string? Timer text color. Stable
countdown.background_color string? Timer background color. Stable
countdown.border_radius integer? Corner radius, in px. Stable
countdown.units[] enum(days|hours|minutes|seconds) The units shown. Stable
countdown.current.visible_phase enum(hidden|before_launch|during_preorder) The phase when last published. Can be minutes stale: work it out from the keys above. Internal
countdown.current.target_at timestamp? Same, the time counted to. Internal
countdown.current.heading_text string? Same, the heading. Internal
countdown.current.starts_at timestamp? Same, the start date the timer uses. Internal
countdown.current.ends_at timestamp? Same, the end date the timer uses. Internal

markets, advanced, integrations

Key Type Meaning Stability
markets.scope enum(all|selected) Sold in every market, or only those listed. Stable
markets.shopify_market_ids[] gid(Market) The markets, when scope is selected. Stable
advanced.checkout_method enum(selling_plan|line_item_property) Checked out as a Shopify selling plan, or as a line item property. Stable
advanced.cart_attributes.show_payment boolean? Add the payment terms as a line item property. Stable
advanced.cart_attributes.show_shipping boolean? Add the shipping text as a line item property. Stable
advanced.cart_attributes.custom_text string? A custom line item property. Stable
integrations.b2b.enable_b2b boolean The offer applies to B2B buyers. Stable

batches

Key Type Meaning Stability
batches.release_strategy enum(sequential|all_at_once) Sell batches one after another, or all at once. Stable
batches.status_text.past string? Label for a sold-out batch. Stable
batches.status_text.live string? Label for the batch on sale. Stable
batches.status_text.upcoming string? Label for a later batch. Stable
batches.widget.style string Batch widget layout (roadmap by default). Stable
batches.widget.progress enum(counts|percent) Show progress as counts or a percentage. Stable
batches.widget.show_other_ship_dates boolean Show the other batches’ ship dates. Stable
batches.widget.show_names boolean Show batch names. Stable
batches.items[].position integer Order of the batch, from 1. Stable
batches.items[].quantity_limit integer? Units in the batch. Stable
batches.items[].shipping_text string? The batch’s shipping text. Stable
batches.items[].label string The batch’s name, such as “Batch 2”. Stable

translations

Key Type Meaning Stability
translations.<locale> json The translated text for one locale, under the same keys as above (for example widget.button.button_text). Only keys with a translation are there; use the base value for the rest. Stable
Owner Namespace and key Type Meaning Storefront Stability
Product variant $app · offer list.metaobject_reference to $app:offer The offers the variant belongs to. Public read Stable
Selling plan $app · offer metaobject_reference to $app:offer The offer that owns this selling plan. Public read Stable
Product, product variant, order restockrocket_production · tracked single_line_text_field "1" when STOQ tracks the resource; absent otherwise. Admin API only; filter with metafields.restockrocket_production.tracked:"1" on products and orders. None Stable

Back-in-stock settings are not in this contract

Section titled “Back-in-stock settings are not in this contract”

A variant’s back-in-stock settings (button visibility, restock message, widget template) are not variant metafields today, and nothing STOQ publishes for them is covered here. STOQ keeps them in shop-level restockrocket_production metafields, keyed by variant ID: enabled_notify_me_variant_ids, disabled_notify_me_variant_ids, restock_notes and back_in_stock_templates. They are written only for shops that use per-variant notify-me settings, and their shape can change without notice. Don’t build on them.

To read a variant’s back-in-stock settings, use the JavaScript API in the browser, or the API v2 from your server. App-owned back-in-stock fields on the variant are planned. They join this page, with a new contract version, only when they are published.

First published contract: the $app:offer metaobject and its json keys, the variant and selling plan offer references, and the tracked markers.

Was this page helpful?

Still stuck? Ask Quinn or chat with support