Skip to content

Add POS shopify.printing API (getPrinters + printer selection)#4515

Open
aaronschubert0 wants to merge 4 commits into
2026-07-rcfrom
retail-extensions/printing-api-types
Open

Add POS shopify.printing API (getPrinters + printer selection)#4515
aaronschubert0 wants to merge 4 commits into
2026-07-rcfrom
retail-extensions/printing-api-types

Conversation

@aaronschubert0

@aaronschubert0 aaronschubert0 commented Jun 16, 2026

Copy link
Copy Markdown

What

Adds the POS shopify.printing API to the 2026-07 surface, per the approved TAG spec Shopify/ui-api-design#1413. This is the types layer of the cross-repo Printing API work.

const printers = await shopify.printing.getPrinters();
const receiptPrinter = printers.find((p) => p.connected);

if (receiptPrinter) {
  await shopify.printing.print('/print/receipt', {printer: receiptPrinter});
} else {
  await shopify.printing.print('/print/receipt'); // system print dialog
}

Changes

  • api/printing-api/printing-api.ts (new):
    • PrintingApiContentgetPrinters(): Promise<Printer[]> and print(src, options?): Promise<void>
    • PrintOptions{ printer?: Printer }
    • Printer{ id: string; name: string; connected: boolean }
    • PrintingApi{ printing: PrintingApiContent } (the shopify.printing namespace)
    • JSDoc mirrors the committed spec; each interface carries @publicDocs for shopify.dev generation.
  • standard-api.ts: add PrintingApi to StandardApi.
  • api.ts: export the new public types.
  • print-api.ts: @deprecate PrintApi / PrintApiContent in favor of shopify.printing. shopify.print stays as a deprecated alias.
  • Changeset: minor.

Notes

  • This PR is types only. Runtime behavior (version gating to >= 2026-07, getPrinters() returning the connected receipt printer, and routing print(src, {printer}) to it) lands in the extensibility plugin (PR A2) and the pos-mobile bridge (PR B2).
  • Printer follows the committed spec exactly — { id, name, connected }, no type field.

Testing

  • tsc --noEmit over @shopify/ui-extensions: 0 errors.

Related

🤖 Drafted with pi.

@aaronschubert0 aaronschubert0 requested a review from a team June 17, 2026 08:34
@aaronschubert0 aaronschubert0 marked this pull request as ready for review June 17, 2026 08:35
Introduces the `shopify.printing` API for the 2026-07 POS surface:

- printing-api.ts: PrintingApi / PrintingApiContent with getPrinters() and
  print(src, options?), plus PrintOptions { printer?: Printer } and
  Printer { id, name, connected }. Mirrors the approved TAG spec
  (Shopify/ui-api-design#1413) and aligns with the WICG Web Printing model.
- standard-api.ts: add PrintingApi to StandardApi.
- api.ts: export the new public types.
- print-api.ts: deprecate PrintApi / PrintApiContent in favor of shopify.printing.

shopify.print remains as a deprecated alias; shopify.printing supersedes it.
… mock

- standard-api.ts: PrintApi is intentionally kept in the StandardApi
  intersection so shopify.print keeps working as a deprecated alias of
  shopify.printing.print(). Suppress import/no-deprecated at the import and
  the intersection use (eslint runs with --max-warnings 0).
- factories.ts: add the now-required `printing` property to the POS
  StandardApi test mock (getPrinters + print).

Assisted-By: devx/8a5a23f1-0153-4f26-8b62-47e474da9689
@aaronschubert0 aaronschubert0 force-pushed the retail-extensions/printing-api-types branch from a1dac9f to 9d6b253 Compare June 18, 2026 08:49
Aligns the schema with the host-plugin behavior: receipt printers render
HTML/image content only, so print(src, {printer}) with a PDF src throws.
Adds the @throws entry and clarifies that PDFs print via the system dialog.

Assisted-By: devx/8a5a23f1-0153-4f26-8b62-47e474da9689
Assisted-By: devx/8a5a23f1-0153-4f26-8b62-47e474da9689
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants