Skip to content

[Checkout UI Ext] Checkout data API examples + descriptions#4173

Open
SteveSill wants to merge 1 commit into2026-04-rcfrom
2026-04-checkout-data-examples
Open

[Checkout UI Ext] Checkout data API examples + descriptions#4173
SteveSill wants to merge 1 commit into2026-04-rcfrom
2026-04-checkout-data-examples

Conversation

@SteveSill
Copy link
Copy Markdown
Contributor

@SteveSill SteveSill commented Mar 19, 2026

⚠️ This PR will not be merged as is. The content will remain the same though. We're waiting on this PR: https://app.graphite.com/github/pr/shop/world/488122 , then I will remake this PR. ⚠️

Closes https://github.com/shop/issues-learn/issues/1044

Summary

  • Adds 17 new Preact code examples for checkout data APIs that previously had no examples or fewer than two
  • Updates 10 existing example titles to use action-oriented imperative verbs, aligning with admin and POS surface conventions
  • All examples follow established checkout extension patterns: identical boilerplate, verified TypeScript types, Polaris web components

New examples (2 per API)

API Default example Additional example
Addresses Read the shipping address Read the billing address
Buyer Identity Display customer information Display B2B purchasing company details
Checkout Token Access the checkout token Display a checkout reference for support
Cost Display an order cost summary Show progress toward free shipping
Discounts Display applied discount codes Apply and remove discount codes
Gift Cards Display applied gift cards Apply a gift card
Note Display the order note Add or update an order note

Additional examples (1 per API, bringing count to 2+)

API New example
Cart Lines Display cart line item details
Customer Privacy Display a consent banner
Order Display a first-time buyer offer

Existing title updates

Changed 10 existing example titles from gerunds/noun phrases to imperative verbs (e.g. "Reading the selected shipping option" → "Read the selected shipping option", "Delivery groups" → "Read delivery groups").

@github-actions
Copy link
Copy Markdown
Contributor

🚨🚨🚨 Docs migration in progress 🚨🚨🚨

We are actively migrating UI extension reference docs to MDX in the areas/platforms/shopify-dev zone of the monorepo. This impacts docs for the following surfaces:

During this migration, please be aware of the following:

.doc.ts files are being deprecated. Changes to .doc.ts files in this repo will not be reflected in the new MDX-based docs. If you need to update docs for a reference that has already been migrated, make your changes directly in the areas/platforms/shopify-dev zone of the monorepo instead.

Doc comments in .ts source files (the comment blocks above types and functions) are also affected. Generating docs from these comments currently requires a newer version of the @shopify/generate-docs library that isn't yet available. Updates to doc comments may not produce the expected output until the migration is complete.

Examples that previously lived in this repo are being moved to the areas/platforms/shopify-dev zone of the monorepo and should be authored there going forward.

What should I do?

  • If your PR includes changes to .doc.ts files, doc comments, or examples, please reach out to us in #devtools-proj-templated-refs so we can help ensure your updates are captured correctly.
  • If your PR is limited to source code changes (non-docs), you can ignore this notice.

Thanks for your patience while we complete the migration! 🙏

@SteveSill SteveSill force-pushed the 2026-04-checkout-data-examples branch 4 times, most recently from 9bb29df to 32dd732 Compare March 19, 2026 23:38
@SteveSill SteveSill self-assigned this Mar 19, 2026
@SteveSill SteveSill force-pushed the 2026-04-checkout-data-examples branch from 32dd732 to 8e8249b Compare March 20, 2026 01:52
@SteveSill SteveSill added the #gsd:49303 Shopify Dev Docs: UI Extension Reference Docs: Quality & Completeness label Mar 20, 2026
@SteveSill SteveSill marked this pull request as ready for review March 20, 2026 15:01
@SteveSill SteveSill changed the title Add examples for checkout data APIs [Checkout UI Ext] Checkout data API examples + descriptions Mar 23, 2026
Add 17 new Preact code examples for checkout data APIs that previously
had no examples or fewer than two.

New examples (2 per API):
- Addresses: read shipping address, read billing address
- Buyer Identity: display customer info, display B2B company
- Checkout Token: access token, display support reference
- Cost: order cost summary, free shipping progress
- Discounts: display codes, apply/remove codes
- Gift Cards: display applied cards, apply a card
- Note: display note, add/update note

Additional examples (1 each):
- Cart Lines, Customer Privacy, Order

Also updates 10 existing example titles to imperative verbs.

Made-with: Cursor
@SteveSill SteveSill force-pushed the 2026-04-checkout-data-examples branch from 8e8249b to 860ec64 Compare March 23, 2026 00:52
Copy link
Copy Markdown
Contributor

@timtrevor-shopify timtrevor-shopify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of minor comments, Steve, otherwise LGTM!

...createExample('cost/order-summary', {
title: 'Display an order cost summary',
description:
'Use `useSubtotalAmount`, `useTotalShippingAmount`, `useTotalTaxAmount`, and `useTotalAmount` to render a full cost breakdown. Shipping and tax are conditionally rendered since they may be unavailable on earlier checkout steps.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not completely clear what 'conditionally rendered' means here - is that just a fancy way of saying if it's there we'll show it, otherwise we won't?

...createExample('discounts/discount-codes', {
title: 'Display applied discount codes',
description:
'Use the `useDiscountCodes` hook to list all active codes on the checkout. Each code is rendered in a stack, and the extension returns nothing when no codes are applied.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume 'stack' here means the Polaris stack component? Might be worth spelling this out explicitly, as 'stack' obviously has other connotations to devs.

...createExample('note/display-note', {
title: 'Display the order note',
description:
'Use the `useNote` hook to read the note attached to the checkout. The note is displayed in a banner only when one exists, and the extension renders nothing otherwise.',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'Use the `useNote` hook to read the note attached to the checkout. The note is displayed in a banner only when one exists, and the extension renders nothing otherwise.',
'Use the `useNote` hook to read a note if one is attached to the checkout. The note is displayed in a banner only when one exists, and the extension renders nothing otherwise.',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Checkout UI Extensions #gsd:49303 Shopify Dev Docs: UI Extension Reference Docs: Quality & Completeness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants