Skip to main content

Purchase Options Card Configuration API

Requires the admin action component.

The Purchase Options Card Configuration API provides access to purchase option selection data for products with subscription and selling plan configurations. Use this API to build action extensions that interact with selected purchase options on product and product variant details pages.

  • Subscription configuration: Configure purchase options card for subscription products.
  • Selling plan UI: Build interfaces for managing selling plan configurations.
  • Purchase options: Customize purchase options displayed on product pages.
  • Card settings: Configure how purchase options cards appear to customers.

The shopify global object provides access to selected purchase option data. Access the following properties on shopify to interact with currently selected products and selling plans in the admin.product-purchase-option.action.render and admin.product-variant-purchase-option.action.render targets.

required

Provides methods for authenticating calls to your app backend. Use the idToken() method to retrieve a signed JWT token that verifies the current user's identity for secure server-side operations.

Anchor to close
close
() => void
required

Closes the extension modal. Use this when your extension completes its task or the merchant wants to exit. Equivalent to clicking the close button in the overlay corner.

{ selected: { id: string; sellingPlanId?: string; }[]; }
required

Selected purchase option data including product and selling plan identifiers.

Anchor to extension
extension
{ target: ; }
required

The identifier of the running extension target. Use this to determine which target your extension is rendering in and conditionally adjust functionality or UI based on the extension context.

required

Utilities for translating content according to the current localization of the admin. Use these methods to provide translated strings that match the merchant's language preferences, ensuring your extension is accessible to a global audience.

Anchor to intents
intents
required

Provides information to the receiver of an intent. Use this to access data passed from other extensions or parts of the admin when your extension is launched through intent-based navigation.

Anchor to picker
picker
required

Opens a custom selection dialog with your app-specific data. Use the Picker API to define the picker's heading, items, headers, and selection behavior. Returns a Promise that resolves to a Picker object with a selected property for accessing the merchant's selection.

Anchor to query
query
< = unknown, Variables = { [key: string]: unknown; }>(query: string, options?: { variables?: Variables; version?: Omit<, "2023-04">; }) => Promise<{ data?: ; errors?: []; }>
required

Executes GraphQL queries against the GraphQL Admin API. Use this to fetch shop data, manage resources, or perform mutations. Queries are automatically authenticated with the current user's permissions. Optionally specify GraphQL variables and API version for your query.

Anchor to resourcePicker
resourcePicker
required

Opens the resource picker modal for selecting products, variants, or collections. Returns the selected resources when the user confirms their selection, or undefined if they cancel.

Anchor to storage
storage
required

Provides methods for persisting data in browser storage that is scoped to your extension. Use this to store user preferences, cache data, maintain state across sessions, or save temporary working data. Storage is persistent across page reloads and isolated per extension.


  • Handle operations based on selling plan selection: Items in api.data.selected have an optional sellingPlanId property. When present, perform subscription-specific operations. When absent, treat it as a one-time purchase.

  • The action only appears when selling plan groups exist on the product or variant. The action is hidden for products without subscription options, even if your extension is installed.
  • Items in api.data.selected have an optional sellingPlanId property. When present, the merchant selected a specific selling plan. When absent, they selected the product/variant without a specific plan.
  • Your extension can't modify selling plan configurations. The API is read-only for selling plan data. Use GraphQL mutations to update selling plans if needed.
  • Selection data only includes IDs. You must query GraphQL for full product, variant, and selling plan details like billing policy and pricing adjustments. Selling plan group data is also unavailable. Your extension only receives individual selling plan IDs but not the parent selling plan group structure.

Was this page helpful?