Skip to main content

Admin Print Action Extensions

Admin print actions add a “Print” button to an admin resource page that produces a print-ready document for that resource — packing slips, branded invoices, gift receipts, return forms, pick lists, anything that ends in a window.print() call. Unlike Admin Actions (which open an interactive modal), print actions exist for one job: render a printable view and hand it to the browser’s native print dialog. The admin opens a new window for the printable view, which opens the print dialog as soon as it is ready.
The current build renders printable HTML and uses the browser’s native print dialog. Headless-Chrome PDF generation, page-size hints, and direct receipt-printer support are tracked as future work — see Roadmap.

How it works

The host (the admin) opens the response in a new window:
  • Template mode — the response includes html already wrapped in a print-ready envelope (with <script>window.print()</script> baked in). The new window writes the HTML, the script fires on load, and the print dialog opens automatically.
  • Iframe mode — the host points the new window at your iframeUrl. Your app is responsible for fetching whatever it needs, rendering the printable view, and opening the print dialog itself — window.print(), or the React <AdminPrintAction> container, which does it once your content is ready.
Authenticate the print window with id_token. The window opens outside the admin, so your page cannot ask App Bridge for a session token. The admin therefore appends id_token to your iframeUrl: a short-lived session token signed with your app’s client secret (HS256, aud = your client id). Verify it exactly like any other session token and read the store from its storeId claim. Fetch the order with that store’s Admin API token, never with a store id taken from the URL. A request without a valid id_token must not render customer data.
If the merchant cancels the print dialog, the new window stays open and the user can re-trigger printing manually. There is no callback to your app for cancellation.

Two rendering modes

You choose one of these per print action. The choice is dictated by which field you set on the manifest: template (string of Aqua/Liquid) or appUrl (HTTPS URL).

Template mode

Ship an Aqua/Liquid template string. The platform renders it server-side with the resource id in context and returns HTML wrapped in a print envelope. Zero app-server work at print time.

Iframe mode

Ship a URL. The platform returns a signed URL the host opens in a new window. Your app generates the printable view dynamically, fetching whatever live data it needs.
Pick template mode for layouts that depend only on the resource id and a few static fields (packing slip header, simple invoice). Pick iframe mode when the printable content depends on data outside the resource (live inventory, branded marketing pixels, customer-specific copy). A single print action must not set both template and appUrl. The server checks appUrl first; if both are set it’s used and template is ignored. Pick one.

Available targets

Additional admin.{resource}-details.print.render targets for product, draft order, gift card, customer, and shipment pages are planned as the respective admin detail pages get wired in. Track this in the Roadmap.

Extension manifest

Each print action is one entry in extensions.printActions on your app.json. After install, each entry is persisted as a single schema file at:
This is the file the API reads at print time. Reinstalling overwrites the file; uninstalling removes the parent extension directory.

Template-mode manifest

Iframe-mode manifest

Fields

The schema persisted on disk is the manifest entry verbatim (with name and title merged for back-compat). Schema mode is detected at print time by checking appUrl first, then falling back to template.

Rendering endpoint

When the merchant clicks your print action’s button, the admin host sends a POST to the platform to resolve the action:
Required fields: domainSlug, appHandle, handle. resourceId and resourceType are surfaced to your template and as iframe query params. An Authorization: Bearer header must be present — a request without one returns 401 {"error":"Missing bearer token"}. The admin host adds the merchant’s token automatically when it calls this endpoint; you only need to send it yourself if you’re calling the endpoint directly (e.g. while testing). The endpoint is CORS-open (Access-Control-Allow-Origin: *) so the admin can call it cross-origin.

Template-mode response

The host pops a new window, writes the returned HTML into it, and the embedded <script>window.print()</script> fires automatically once the page paints.

Iframe-mode response

The host opens iframeUrl in a new window. The query params are appended automatically — see Iframe-mode details. When the extension belongs to an externally hosted app, the admin also appends id_token (see the note in How it works).

Error responses

Template-mode details

In template mode your Aqua/Liquid template is rendered server-side using the same engine that powers theme rendering. You get the full filter library (money, date, default, escape, etc.) and the full render / include / for syntax. The context exposed to the template:
For an order print, order is the full Aqua order object — the same one a theme’s customers/order template renders: order.name, order.line_items (title, quantity, sku, final_price, …), order.shipping_address, order.customer, the totals — and shop is the store. The order is only loaded when it belongs to the merchant’s store. For any other resourceType, the resource is mirrored under that name with its id only ({{ customer.id }} when resourceType is "customer"). If your template needs more, use iframe mode and fetch the resource yourself. The rendered HTML is wrapped in a minimal envelope:
The default @media print rule zeroes padding so your content prints edge-to-edge. Override it in your own <style> block if you need margins.

Example: packing slip template

Example: minimal invoice template

Iframe-mode details

In iframe mode your appUrl is opened in a new window with these query parameters appended: If your appUrl already contains a query string, the params are merged. If appUrl is unparseable as a URL (relative path, missing scheme), it is returned as-is and the host opens it verbatim. Your printable page should:
  1. Read the params. They tell you which resource to render.
  2. Authenticate with id_token. The window is outside the admin, so App Bridge cannot mint a session token there — the id_token param is your session token. Send it to your backend as Authorization: Bearer <id_token> and verify it like any session token. With the SDK you don’t have to read it yourself: in a top-level window app.getSessionToken() (and useSessionToken, useAppQuery, useRestApi) return the unexpired id_token from the URL.
  3. Render the page. Same DOM you’d use for any printable web view.
  4. Print. Call window.print() once the DOM is fully painted — typically inside a load handler or a short setTimeout so images have time to lay out. In React, wrap the page in <AdminPrintAction> and call usePrintReady().setReady(true) when your data has loaded; it opens the dialog once.

Why use iframe mode

  • You print a resource other than an order, and need more than its id (template mode hydrates orders only).
  • The printable view depends on data only your service has (subscription cadence, custom inventory state, multi-warehouse pick paths).
  • You want to ship marketing/branded HTML that you control end-to-end without redeploying the merchant’s app.

Why use template mode

  • Zero app-server work at print time. The platform is the only thing online.
  • You only need the resource id stamped on a layout (gift receipt with no prices, simple thank-you slip).
  • You want offline-friendly behaviour — no need for the merchant to have working internet to your app, only to LaunchMyStore.

Installing print actions

Print actions install the same way as every other extension type: add a printActions array under extensions in app.json.
Extensions are deployed by the platform from your app’s extensions manifest when a merchant installs the app (and re-synced when you publish a new version) — there is no endpoint for you to call. Ship the files with your app and declare them in app.json.
After install, each entry lives in:
The platform picks these up and exposes them under the admin_print_action type to the host, which renders each one as a button on the resource page in the admin. Subsequent installs overwrite existing schema files — there is no “add to existing” semantics. Always send your full set of print actions on each install.

Multiple print actions per app

One app can register many print actions for the same target — each gets its own button (with its icon and title), sorted by handle. This is the typical pattern for warehouse / fulfilment apps that ship a suite (packing slip + pick list + return form + gift receipt):

Use cases

  • Packing slips — pulled at the warehouse, listing what to grab before sealing the box.
  • Branded invoices — custom layouts with the merchant’s logo, terms, bank details, tax IDs.
  • Gift receipts — recipient-friendly receipts that hide prices.
  • Return labels / RMA forms — pre-filled return paperwork the customer service rep can hand to the customer.
  • Pick lists — multi-order picking sheets used by fulfilment teams.
  • Compliance documents — country-specific export forms, dangerous goods declarations, customs invoices.

Roadmap & hardware integration

The current build is intentionally minimal — printable HTML + browser print dialog. Several extensions are tracked for future releases:
  • Headless-Chrome PDF rendering. Optional server-side flag on the manifest (renderAs: 'pdf') that returns a PDF buffer instead of HTML, so the merchant can save / email the result without re-rendering client-side.
  • More targets. Print actions on the product detail page (barcode labels), draft order page (proforma invoice), gift card page (printed gift card), and shipment page (carrier label).
  • Receipt-printer / thermal-printer integration. Today the platform uses the browser print dialog only — any printer the OS exposes works (laser, inkjet, label printer, thermal receipt printer). Direct ESC/POS or ZPL output to a USB/network receipt printer (without the browser dialog round-trip) is not wired and will require a native bridge or a WebUSB-based POS-side helper. Track this in the roadmap; for now, point your thermal printer at the OS print queue and pick it in the browser dialog.
  • Print presets. Save a merchant’s preferred paper size, orientation, and margins per action so the dialog opens with the right defaults.
  • Bulk print. Select N orders in the order list and run a single print action across all of them (useful for end-of-day fulfilment).
If you need any of these sooner, raise it on the developer forum so we can prioritize.

See also