Skip to content

Conversation

@janezhu918
Copy link

@janezhu918 janezhu918 commented Nov 5, 2025

Background

This PR adds example code for a Point of Sale UI extension that demos how to implement subscription functionality.

Related to https://github.com/Shopify/shopify-dev/pull/64603 - planning to reference these codeRefs in the doc, but I can't link them until they are actually published.

Solution

Added three new files to demonstrate a complete subscription example for Point of Sale UI extensions:

  1. Modal.jsx - Implements a modal that:
    • Fetches selling plans for a product variant using GraphQL
    • Displays available subscription options
    • Handles selection of a subscription plan
  2. Tile.jsx - Creates a tile component that:
    • Subscribes to cart updates to detect subscription-eligible items
    • Enables/disables the tile based on whether subscription options are available
    • Opens the modal when clicked
  3. shopify.extension.toml - Configuration file that:
    • Defines the extension targeting both the POS home tile and modal render targets

The example demonstrates best practices for implementing subscription functionality in POS UI extensions, including proper data fetching, state management, and user interaction patterns.

🎩

  • Run the example in a development environment
  • Add a subscription-eligible product to the cart
  • Verify the subscription tile becomes enabled
  • Click the tile and confirm the modal displays available subscription options
  • Select a subscription plan and verify it's applied to the cart item

Checklist

  • I have 🎩'd these changes
  • I have updated relevant documentation

Copy link
Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@janezhu918 janezhu918 added the #gsd:45531 Shopify Retail: Support Subscriptions on POS via Extensible Selling Plans label Nov 5, 2025 — with Graphite App
@janezhu918 janezhu918 self-assigned this Nov 5, 2025
@janezhu918 janezhu918 force-pushed the jane/add_code_examples_of_pos_subscriptions_ui_extension branch 3 times, most recently from 94f4f66 to 0aa20a5 Compare November 5, 2025 20:52
@janezhu918 janezhu918 force-pushed the jane/add_code_examples_of_pos_subscriptions_ui_extension branch from 0aa20a5 to a3df23d Compare November 5, 2025 20:53
Copy link
Contributor

@NathanJolly NathanJolly left a comment

Choose a reason for hiding this comment

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

Generally supportive: Just want to keep in mind that every new addition to examples introduces maintenance load, so let's make sure the examples are of good quality and provide value we don't already provide somewhere else.

In this case, I'd argue this does provide unique value in that our other examples do not showcase any direct API usage.

<s-clickable key={`${plan.name}-clickable`} onClick={() => {
handleClick(plan)
}}>
<s-text key={`${plan.name}-text`}>{plan.name}</s-text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious: What does the key prop do in this context?

Copy link
Author

Choose a reason for hiding this comment

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

Because we're looping through the selling plans here, it's good practice to include a unique key to tell these components apart.

@janezhu918
Copy link
Author

Closing this branch in favor of https://app.graphite.com/github/pr/Shopify/ui-extensions/3552/Add-code-examples-of-POS-subscriptions-UI-extension (needed to fix branch name to properly reference them in my shopify-dev branch). This branch has the "/" (extra slash) that breaks parsing.

@janezhu918 janezhu918 closed this Nov 6, 2025
@janezhu918 janezhu918 deleted the jane/add_code_examples_of_pos_subscriptions_ui_extension branch November 6, 2025 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

#gsd:45531 Shopify Retail: Support Subscriptions on POS via Extensible Selling Plans

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants