All guides · Offers
Headless stores and apps
A headless store or a mobile app can show your offers and charge their prices, with no theme. The checkout takes an offer off any cart that qualifies, however its items got there, so a cart made by your own store front or app gets the offer's price with nothing more to do.
To show the tiers on your own product page, your developer reads the app's fields through Shopify's Storefront API and draws them with the app's own engine, the one your theme's product page and the checkout use, so the page says what the checkout charges. The rest of this page is for them.
The fields are under the namespace app--<the app's number>. In the Storefront API they are named by it, not by "$app", which only the app itself may use. In your Shopify admin, this guide in the Bundles app shows the namespace of your app filled in.
- On a product, "offer": the product's own offer, as JSON text. And "others": the other products that offer names (a set's products, its gifts, its add-ons), as a list of products.
- On the shop, "wide": the offers on collections and on all products, as JSON text, in the order a product takes them. And "others": the other products they name. And "paused", only while every offer is paused on the app's Settings page: then the engine gives no product an offer, as your theme shows none.
Any Storefront API token of your store can read them. Anyone who has one can read what your product pages show, and also the countries and customer tags each offer is for, so do not name a customer tag you want to keep private in an offer.
The engine file is one JavaScript module with no imports of its own, about 72 KB (21 KB zipped). Download it again when What's new says the offers changed.
query BundlesPage($handle: String!, $country: CountryCode, $language: LanguageCode) @inContext(country: $country, language: $language) {
localization { country { isoCode currency { isoCode } } language { isoCode } }
shop {
paymentSettings { currencyCode }
wide: metafield(namespace: "app--<the app's number>", key: "wide") { value }
paused: metafield(namespace: "app--<the app's number>", key: "paused") { value }
others: metafield(namespace: "app--<the app's number>", key: "others") { references(first: 50) { nodes { ...BundlesProduct } } }
}
product(handle: $handle) {
...BundlesProduct
isGiftCard
collections(first: 250) { nodes { id } }
offer: metafield(namespace: "app--<the app's number>", key: "offer") { value }
others: metafield(namespace: "app--<the app's number>", key: "others") { references(first: 50) { nodes { ...BundlesProduct } } }
}
}
fragment BundlesProduct on Product {
id
title
variants(first: 250) { nodes { id title availableForSale price { amount } compareAtPrice { amount } } }
}import { readPage, choiceOf, formatMoney, fill, headingOf, sells, holds, unmet } from "./weird-bundles-engine.js";
// data: the Storefront API's answer to the query above.
// today: your store's own day, in its time zone. tags: the signed-in customer's tags.
// business: whether the buyer buys for a company (Shopify B2B). orders: the signed-in customer's number of orders
// (the Storefront API's customer { numberOfOrders }), null for a guest. rate: see below.
const page = readPage(data, { today: "2026-10-12", tags: [], business: false, orders: null });
if (page.offer && page.priced) {
const choice = choiceOf(page);
let state = choice.start(); // the tier the shop marked is chosen
const now = choice.read(state, variantNumber); // the variant the buyer chose, by its number
for (const card of now.cards()) {
// card.tier.title, card.figures.total (without the offer), card.figures.off, card.figures.pay,
// in hundredths of the buyer's currency: formatMoney(card.figures.pay, "${{amount}}"), or in place of the format one
// amount as your page writes 12,345.00 in the buyer's currency ("€12.345,00", "¥12,345"), and every figure is written that way
// card.tier.badge and card.tier.subtitle may say the tier's figures: fill(card.tier.subtitle, card.figures, { money, count: card.held.length }),
// where money writes an amount (as formatMoney above); null means the line is not shown
}
// The heading may say the most a tier saves, {{percent}} and {{saved}}: headingOf(page.offer.heading, now.cards(), { money }); null means none
state = now.act("tier", 2); // the buyer chose the third tier
const lines = choice.read(state, variantNumber).cart().lines;
// [{ id: variant number, quantity }]: add each with cartLinesAdd, merchandiseId "gid://shopify/ProductVariant/" + id,
// attributes [{ key: NOTE, value: page.id }] (NOTE is "_wb", from the engine file: the mark your theme's lines carry)
}How the offer a product shows is picked. The engine does it as your theme's product page and the checkout do:
- The product's own offer, when its field names this product and carries the same "key" as the shop's field. A field with another key was left by an earlier install of the app and counts for nothing.
- Else the shop's first offer on a collection the product is in, then the one on all products, unless it leaves the product out ("out").
- An offer counts only from its first day to its last ("starts", "ends", in your store's own days), and only for its buyers: "countries" (only these, or all but these), "tags" (the signed-in customer's tags, only or all but), "business" (not or only buyers buying for a company) "till" (an offer only at your shop's till never shows on a page), "orders" ("new": a guest or a customer with no order yet; a number as text: a signed-in customer with at least that many orders) and "langs" (the languages, in plain letters like "ptbr", only or all but). A gift card shows no offer.
- An offer may hold "versions" for other markets: the buyer's country takes the first version that names it, else the main tiers. A version with a "currency" has its amounts typed in that currency: used as they are in a cart in it, and passed over for the main tiers in a cart in any other.
The shape of an offer in the fields:
- "v": 1, "key": the install's key, "id": the offer's id, and in a product's own field "product": the product's number.
- "tiers", each with "quantity", "title", "titles" (its name in other languages, each "l" and "t"), and one discount: "percent", "amountEach", "amountOff", "price", or "free" with "getPercent". A set has "with" (its other products, each with its own discount) and "own" (this product's discount in the set). "gifts" (each "product", "variant", "quantity", "keep"), "ship" and "cap" (free shipping), "upTo" (the most items it takes), "chosen" (the tier chosen when the page opens), "badge", "subtitle", "picture".
- "addons", each "product", "variant", "label", "percent", "checked".
- "versions", each "countries", "currency" (only when its amounts are typed in a currency that is not your store's) and "tiers".
- "starts", "ends", "countries", "tags" and "langs" (each "only" and "list"), "business", "till", "orders", "heading", "stepper", "oneVariant", "matchOptions", "giftsAgain", "dearest", "ending" (the price ending, like ".99"), "beyond" (what items past the tier reached do: "full", "packs" or "ranges"; none is the same discount), "subscription".
- The shop's field: "v", "key" and "offers", each with "collection" (its number) or "all", "out" (the products it leaves out), and the rest as above.
Products, variants and collections are named by their number. Amounts are text in your store's currency ("10" is 10.00), unless a version names its own currency.
What else the cart must hold: an offer may save only while the cart also holds some items, its "has" (like "all 2:31: 0-::8": at least 2 items of product 31, and none from collection 8) with "hasNames", what each need is called. Show the offer as always, and while holds(page.offer.has, items) is false, say under the tiers what the cart still needs: unmet(page.offer.has, items) gives the places of the needs to say, each with its name. "items" are the cart's lines, each { product (its id), quantity, collections (the ids of the collections it is in among the ones "has" names) }. The checkout takes nothing off until the cart holds them.
Variants: an offer on one product may be for only some of its variants. readPage then gives "product" with those variants alone, so a picker drawn from page.product.variants lists only them. While the buyer's chosen variant is not among them, show no offer: the checkout takes nothing off its items. sells(page.offer, variantNumber) says whether the offer is for a variant.
Prices in another currency: an amount typed in your store's currency is turned into the buyer's at Shopify's rate, and the Storefront API does not give that rate. A page that knows it passes it to readPage as "rate". Otherwise readPage says "priced": false for an offer with such an amount in another currency: show the tiers' names and say the price is worked out at checkout. Percents, free items and gifts need no rate, but a percent with a most does (2026-10-15: "10% off, up to $10").
What a headless page does not get: the tiers' badges and subtitles in other languages and the Design page's look (both stay in the app), the stock limits your theme's page shows (the engine reads only whether a variant is for sale), and A/B tests (a headless page shows side A, and only your theme's visitors count in a test).
The cart: give each line one attribute, "_wb" with the offer's id (page.id), as your theme's offer marks every line it adds. It is hidden from the buyer, and it lets the app's Orders page and reports say what the offer added. The checkout's price does not need it: a line with no attribute gets the offer too. Shopify's cart already shows the offer's discount, named with the tier's name ("discountAllocations"), so a cart page reads its figures from there. A mobile app that sends buyers to Shopify's checkout gets the offers' prices there too.
A Hydrogen store, or any React store front: the React kit draws the offer with the same engine. Put it beside the engine file. Its hook, useBundlesOffer, gives the offer, its heading, each tier with its figures written in your money, the tier chosen, a choice of tier, and the lines for Shopify's cartLinesAdd; its component, BundlesOffer, draws the tiers the hook gave as radio buttons, a press choosing in the same hook, with the class names of your theme's widget (wb-tier, wb-title, wb-pay), for your own CSS.
import { BundlesOffer, useBundlesOffer } from "~/lib/weird-bundles-react.js";
import { CartForm } from "@shopify/hydrogen";
// data: the Storefront API's answer to the query above, from the route's loader.
export function Offer({ data, variant, today }) {
const offer = useBundlesOffer(data, { today }, { variant, money: "${{amount}}" });
if (!offer.offer) return null;
return (
<CartForm route="/cart" action={CartForm.ACTIONS.LinesAdd} inputs={{ lines: offer.lines }}>
<BundlesOffer offer={offer} />
<button type="submit">Add to cart</button>
</CartForm>
);
}Mobile apps. Any app that sends buyers to Shopify's checkout gets the offers' prices there, with nothing to set up: an app made with Tapcart, Plobal, Vajro, OneMobile or any other builder, and an app of your own. To show the tiers in the app too, use the Tapcart block below, or the React Native starter for an app of your own or a builder that takes React Native code. Neither needs a key from us, an invitation or our servers: each reads your store's own Storefront API.
What both need: a Storefront API token of your store. In your Shopify admin, add Shopify's free Headless sales channel, create a storefront, and copy its public access token. A public token is made to sit inside an app.
A Tapcart app. Tapcart's custom blocks need its Enterprise plan and its command line tool, the Tapcart CLI (Tapcart's App Studio Quick Start says how to set it up).
- Download the block's two files below.
- In your Tapcart project, run tapcart block create WeirdBundlesOffer. Put the first file in the block's folder as code.jsx and the second as manifest.json, in place of the ones the tool made.
- Run tapcart block push WeirdBundlesOffer --live.
- In Tapcart's App Studio, open your product screen and add the block from My Blocks, above the screen's Add to cart.
- In the block's settings, type your store's address (your-store.myshopify.com) and the Storefront API token. The namespace is filled in when you use the manifest shown below in this guide in the Bundles app; with the downloaded one, type app--<the app's number>.
[
{ "id": "shop", "label": "Store address (your-store.myshopify.com)", "type": "text", "defaultValue": "" },
{ "id": "token", "label": "Storefront API token", "type": "text", "defaultValue": "" },
{ "id": "namespace", "label": "Bundles namespace", "type": "text", "defaultValue": "app--<the app's number>" },
{ "id": "addLabel", "label": "Button", "type": "text", "defaultValue": "Add to cart" },
{ "id": "addedLabel", "label": "Button once added", "type": "text", "defaultValue": "Added to cart" },
{ "id": "pricedAtCheckout", "label": "When a price needs your store's rate", "type": "text", "defaultValue": "Price worked out at checkout" },
{ "id": "accent", "label": "Accent color (#rrggbb)", "type": "text", "defaultValue": "#111111" }
]What the block does: on a product with a live offer, it shows the offer's heading and its tiers, each with its name, badge, subtitle, price and the price without the offer struck through, the tier you marked chosen, in the buyer's currency and the tiers' names in the app's language. Its button adds the chosen tier: a set's other products and a tier's gifts too, each line marked as your theme marks them. Every item of the tier is the variant the screen names, or the product's first variant when it names none. On a product with no offer it shows nothing. Tapcart's own Add to cart still works: the checkout gives the offer to any cart that qualifies, so two presses of it get the 2-item tier.
What the block does not do: no box of add-ons, no pop-up, no picker of a variant for each item, no Subscribe and save, no countdown, no sticky bar and no Design page's look (it takes the accent color, and your app's own font). It shows side A of an A/B test, and its views do not count on the Analytics page; its orders do. An offer's first and last day are the phone's day, so near midnight it may show some hours early or late; the checkout follows your store's day. Customer tags and a first order are Tapcart's signed-in customer's; an offer for 2 or more past orders counts any customer with an order as 1.
What Tapcart's cart shows: the tier's items as lines. Whether it shows the discount there is Tapcart's: its cart is Shopify's, which holds the offer's discount by the tier's name, and Shopify's checkout always takes it off, in the app's checkout sheet too. A buy button that skips the cart buys only what it holds, and the checkout prices that.
An app of your own (React Native, Expo). The starter is one component, BundlesOfferNative, on the React kit's hook and the engine file: put the three files beside each other in your app. It draws the offer's tiers with React Native's own views (a radio for each tier, for screen readers), a press chooses, and its button gives the chosen tier's lines. cartAdd puts them into a Shopify cart through the Storefront API and gives the cart's checkout address: open it with Shopify's Checkout Sheet Kit, where the offer comes off as on your store. A builder that takes React Native code takes the component the same way; give its own cart the lines (each a variant's id, a quantity and the "_wb" attribute).
Download the React Native starter
import { useEffect, useState } from "react";
import { Linking, View } from "react-native";
import { askPage, BundlesOfferNative, cartAdd, useBundlesOffer } from "./weird-bundles-native.js";
const STORE = { shop: "your-store.myshopify.com", token: "your-storefront-token", namespace: "app--<the app's number>" };
export function ProductScreen({ handle, variant, cart, setCart }) {
const [data, setData] = useState(null);
useEffect(() => { askPage({ ...STORE, handle, country: "US", language: "EN" }).then(setData, () => setData(null)); }, [handle]);
const offer = useBundlesOffer(data, { today: new Date().toISOString().slice(0, 10) }, { variant, money: "${{amount}}" });
const add = async (lines) => {
const made = await cartAdd({ ...STORE, cartId: cart }, lines);
setCart(made.cartId);
Linking.openURL(made.checkoutUrl); // or Shopify's Checkout Sheet Kit
};
return <View>{data ? <BundlesOfferNative offer={offer} onAdd={add} accent="#111111" /> : null}</View>;
}The React kit's hook, useBundlesOffer, needs only React itself, with no page, no window and no document, so it runs in a React Native app as it runs in Hydrogen. The BundlesOffer component draws web elements (a fieldset and radio buttons), so it is for a web page; BundlesOfferNative is the one for a native screen.
More in Offers
- What a tier can do
- Engraving and personalization
- Offer an upgrade to another product
- Links that fill a cart
- Words on a tier: name, subtitle, badge, lines
- Scheduling, markets and customers
- Why does my offer not show?
- No discount at checkout
- The list of offers
- Suggestions from your sales
- Pause every offer at once
- See what changed, and who changed it
- Test up to four versions of an offer
- Your other apps
- Subscriptions and pre-orders: plans and what renewals get
- Other discounts with your offers
- Business buyers: everyone, not them, or only them
- Selling at your shop's till
- Offers inside checkout
- Versions for other markets
- For developers
Made by Web Weirdos · hello@webweirdos.com · Privacy