All guides · Offers
For developers
Your other tools, partner apps and your developer can read your offers, hear what changes, start Shopify Flow workflows, and work with the offer on your store's pages. Everything is in Settings, Developers, and all of it is optional: your offers work without it. The rest of this page is for your developer.
The API. Make a key on the Developers page for each tool or app, named after it, so you can delete one without stopping the others. A key that reads, reads your offers and their daily counts. A key that also publishes may publish and unpublish an offer and pause or turn back on every offer, by the same rules as the app's own buttons; no key ever changes a discount. The key is shown once; the app keeps only its fingerprint. Each key may ask 120 times a minute, and gets 429 with Retry-After past it. A key names its store, so it reads that store and no other. Keep keys on a server: a key in a store's pages would be anybody's.
curl https://bundles.webweirdos.com/api/v1/offers \
-H "Authorization: Bearer wbk_your-store_..."
GET /api/v1/offers every offer: id, name, status, showing, running, on, products, collection,
starts, ends, updatedAt, liveSince, tiers, addons, test
GET /api/v1/offers/{id} one offer
GET /api/v1/views?from=2026-10-01&to=2026-10-17
how often each offer was seen and added to a cart, by day (180 days at most)
POST /api/v1/offers/{id}/publish with a key that publishes: Publish's checks, then live
POST /api/v1/offers/{id}/unpublish
POST /api/v1/pause every offer paused, as Settings' Pause all offers
POST /api/v1/resumeAmounts are text in your store's currency, as the app keeps them ("10" is 10.00). Products and collections are Shopify's ids, the ones the Admin API uses. "running" is draft, scheduled, ended, live or paused, and "showing" says whether buyers see the offer now.
Webhooks. On the Developers page, add an address that starts with https:// and choose its events: an offer made, changed, starting or stopping to show, deleted; every offer paused or turned back on; an order that used an offer. An offer's event comes within seconds, its body the offer as the API gives it; an order's comes within the hour, with the order's id, the offers it used and what each saved, in hundredths of your store's currency, and never who the buyer is. Each request carries X-Bundles-Topic, X-Bundles-Shop-Domain, X-Bundles-Event-Id (keep it, to read an event sent twice once) and X-Bundles-Hmac-Sha256, the body's HMAC-SHA256 in base64 with your signing secret, as Shopify signs its own webhooks. Answer with a 2xx within 5 seconds. The page shows each address's last answer and sends a test on request.
import { createHmac, timingSafeEqual } from "node:crypto";
const ok = (rawBody, header, secret) => {
const mine = Buffer.from(createHmac("sha256", secret).update(rawBody).digest("base64"));
const theirs = Buffer.from(header ?? "");
return mine.length === theirs.length && timingSafeEqual(mine, theirs);
};Shopify Flow. Four triggers start a workflow: Bundle offer started showing (any offer: its id, name and what it is on), Bundle offer on a product started showing (an offer on one product, the same with the product, so a workflow can read or tag it), Bundle offer stopped showing (unpublished, deleted, or its last day passed), and Order used a bundle offer (the order, the offers' names and ids, and what they saved). For example, with Order used a bundle offer: Add order tags, or Add order note with the offers' names, for your warehouse; or a message to your team.
Helpers on your store. Turn on Public helpers and events on the Developers page. Every page with an offer then has window.WeirdBundles, and each offer sends events from its element, which bubble to the page.
WeirdBundles.widgets() // the offers drawn on the page: element, offer, product, state(), choose(index), refresh()
WeirdBundles.widgets()[0].state() // what the buyer chose: tier, title, quantity, lines, addons, plan, pay, was, off, currency
WeirdBundles.widgets()[0].choose(2) // chooses the third tier, as a press would
// Stop Add to cart until a box is ticked: give false, or words the offer shows the buyer.
WeirdBundles.beforeAdd((state) => document.querySelector("#terms").checked || "Please accept the terms first.");
// After the tier is in the cart: open your drawer, or go to checkout.
WeirdBundles.afterAdd((added) => { window.location.href = "/checkout"; });
WeirdBundles.on("change", (state) => console.log(state.tier, state.pay));
// Events, on document too: weird-bundles:ready, weird-bundles:change, weird-bundles:added, weird-bundles:stoppedYour own button on each product. In Settings, Store front, The offer's products, "Your own button on each product" puts a button with your words beside each other product of an offer, like Size chart. A press sends weird-bundles:button, which needs none of the helpers above, with the product it is beside: the offer, the product's number, its handle and its title, and the number of the page's own product.
document.addEventListener("weird-bundles:button", (event) => {
const { product, handle, title } = event.detail;
openSizeChart(handle); // your theme's own size chart, or anything your code opens
});An offer anywhere. A place tag draws the offer of a product wherever your code puts it, even after the page has loaded, in a pop-up or a drawer: the offer comes with its own Add to cart button where nothing else sells the product.
const place = document.createElement("div");
place.setAttribute("data-weird-bundles-place", "ski-wax"); // the product's handle
document.querySelector("#my-drawer").append(place);Your theme's code. Each live offer is in the product's field "offer", and the offers on collections and on all products in the shop's field "wide", under the namespace app--<the app's number>, as JSON. Your theme's Liquid reads them as the Storefront API does; their shape is in the guide Headless stores and apps. The theme's widget already draws them: read them only for something of your own, such as a line on a collection page.
{%- assign bundles = product.metafields["app--<the app's number>"].offer.value -%}
{%- if bundles -%}
{%- for tier in bundles.tiers -%}{{ tier.title }}{%- unless forloop.last -%}, {% endunless -%}{%- endfor -%}
{%- endif -%}A headless store, or your own React page: the guide Headless stores and apps gives the app's engine and a React kit, with a hook and a component.
Speed of this app in your admin. The Developers page shows how fast the app's own pages are in your Shopify admin, as Shopify measures apps for Built for Shopify: Page shown (LCP, 2.5 s or less), Answer to a click (INP, 200 ms or less) and Page moving as it loads (CLS, 0.1 or less), each at 3 loads in 4, from the last 100 loads of each, with the slowest page named. Your browser measures them with Shopify's App Bridge on each page you open; under 10 loads it says Not enough loads yet.
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
- Headless stores and apps
- Versions for other markets
Made by Web Weirdos · hello@webweirdos.com · Privacy