Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

Resource Picker API

Requires an admin UI block, action, or print extension.

The Resource Picker API lets merchants search for and select products, collections, or product variants. Use this API when your extension needs merchants to choose Shopify resources to work with. The resource picker returns detailed resource information including IDs, titles, images, and metadata.

Tip

If you need to pick app-specific resources like product reviews, email templates, or subscription options, use the Picker API instead.

  • Resource selection: Display resource picker interfaces for selecting Shopify resources.
  • Product selection: Enable product selection in bundle or collection configuration workflows.
  • Customer selection: Select customers for targeting or segmentation purposes.
  • Bulk selection: Support bulk resource selection for batch operations.

The ResourcePickerOptions object defines how the resource picker behaves, including which resource type to display, selection limits, filters, and preselected items. Access the following properties on the ResourcePickerOptions object to configure the resource picker's appearance and functionality.

'product' | 'variant' | 'collection'
required

The type of Shopify resource to select: 'product' for products, 'variant' for specific product variants, or 'collection' for collections. This determines what appears in the picker and what data structure is returned.

Anchor to action
action
'add' | 'select'
Default: 'add'

The action verb that appears in the picker's title and primary button. Use 'add' for actions that add new items (for example, "Add products") or 'select' for choosing existing items (for example, "Select products"). This helps merchants understand the picker's purpose.

Anchor to filter
filter

Filtering options that control which resources appear in the picker. Use filters to restrict resources by publication status, include or exclude variants, or apply custom search criteria. This helps merchants find relevant items faster.

Anchor to multiple
multiple
boolean | number
Default: false

The selection mode for the picker. Pass true to allow unlimited selections, false for single-item selection only, or a number to set a maximum selection limit (for example, 5 allows up to five items). When type is 'product', merchants can still select multiple variants from a single product even if multiple is false.

Anchor to query
query
string
Default: ''

An initial search query that appears in the picker's search bar when it opens. Merchants can see and edit this query. See search syntax for the query format. For most use cases, use filter.query instead, which filters results without exposing the query to merchants.

Anchor to selectionIds
selectionIds
[]
Default: []

Resources that should be preselected when the picker opens. Pass an array of resource objects with IDs (and optional variant IDs) to show which items are already selected. Merchants can deselect these preselected items. Use this to show current selections or default choices.

Anchor to ResourcePicker return payloadResourcePicker return payload

The resource picker returns an array of selected resources when the merchant confirms their selection, or undefined if they cancel. The resource structure in the array varies based on the type option: products include variants and images, collections include rule sets, and variants include pricing and inventory data.

<Type>

  • Filter query runs server-side: The query property in filters isn't visible to merchants and runs as a GraphQL search query. Use it to programmatically restrict results (for example, vendor:Acme) without exposing the filter logic.
  • Handle undefined return on cancellation: When merchants close the picker without selecting, it returns undefined rather than an empty array. Check for undefined explicitly.

  • Only products, variants, and collections are supported. Other resource types like customers, orders, or locations can't be selected. Use the Picker API for custom resources.
  • Product selection with multiple: false doesn't prevent multi-variant selection from the same product. Merchants can select multiple variants from a single product even when multiple: false.
  • Filter options are limited to predefined fields (hidden, variants, draft, archived, query). Custom filter criteria beyond these aren't supported.
  • Returned data structure varies by resource type. Products include a variants array, variants include price and inventoryQuantity, and collections include ruleSet.

Was this page helpful?