--- title: Resource Picker description: > The Resource Picker API provides a search-based interface to help users find and select one or more products, collections, or product variants, and then returns the selected resources to your app. Both the app and the user must have the necessary permissions to access the resources selected. > Tip: > If you are picking app resources such as product reviews, email templates, or subscription options, you should use the [Picker](picker) API instead. api_version: 2025-04 api_name: admin-extensions source_url: html: 'https://shopify.dev/docs/api/admin-extensions/2025-04/api/resource-picker' md: 'https://shopify.dev/docs/api/admin-extensions/2025-04/api/resource-picker.md' --- # Resource Picker Requires an Admin [block](https://shopify.dev/docs/api/admin-extensions/2025-04/extension-targets#block-locations), [action](https://shopify.dev/docs/api/admin-extensions/2025-04/extension-targets#action-locations), or [print](https://shopify.dev/docs/api/admin-extensions/2025-04/extension-targets#print-locations) extension. The Resource Picker API provides a search-based interface to help users find and select one or more products, collections, or product variants, and then returns the selected resources to your app. Both the app and the user must have the necessary permissions to access the resources selected. Tip If you are picking app resources such as product reviews, email templates, or subscription options, you should use the [Picker](https://shopify.dev/docs/api/admin-extensions/2025-04/api/resource-picker.md/picker) API instead. ## Resource Picker Options The `Resource Picker` accepts a variety of options to customize the picker's behavior. * type 'product' | 'variant' | 'collection' required The type of resource you want to pick. * action 'add' | 'select' Default: 'add' The action verb appears in the title and as the primary action of the Resource Picker. * filter Filters Filters for what resource to show. * multiple boolean | number Default: false Whether to allow selecting multiple items of a specific type or not. If a number is provided, then limit the selections to a maximum of that number of items. When type is Product, the user may still select multiple variants of a single product, even if multiple is false. * query string Default: '' GraphQL initial search query for filtering resources available in the picker. See [search syntax](https://shopify.dev/docs/api/usage/search-syntax) for more information. This is displayed in the search bar when the picker is opened and can be edited by users. For most use cases, you should use the `filter.query` option instead which doesn't show the query in the UI. * selectionIds BaseResource\[] Default: \[] Resources that should be preselected when the picker is opened. ### Filters * archived Whether to show \[archived products]\(https://help.shopify.com/en/manual/products/details?shpxid=70af7d87-E0F2-4973-8B09-B972AAF0ADFD#product-availability). Only applies to the Product resource type picker. Setting this to undefined will show a badge on draft products. ```ts boolean | undefined ``` * draft Whether to show \[draft products]\(https://help.shopify.com/en/manual/products/details?shpxid=70af7d87-E0F2-4973-8B09-B972AAF0ADFD#product-availability). Only applies to the Product resource type picker. Setting this to undefined will show a badge on draft products. ```ts boolean | undefined ``` * hidden Whether to show hidden resources, referring to products that are not published on any sales channels. ```ts boolean ``` * query GraphQL initial search query for filtering resources available in the picker. See \[search syntax]\(/docs/api/usage/search-syntax) for more information. This is not displayed in the search bar when the picker is opened. ```ts string ``` * variants Whether to show product variants. Only applies to the Product resource type picker. ```ts boolean ``` ```ts interface Filters { /** * Whether to show hidden resources, referring to products that are not published on any sales channels. * @defaultValue true */ hidden?: boolean; /** * Whether to show product variants. Only applies to the Product resource type picker. * @defaultValue true */ variants?: boolean; /** * Whether to show [draft products](https://help.shopify.com/en/manual/products/details?shpxid=70af7d87-E0F2-4973-8B09-B972AAF0ADFD#product-availability). * Only applies to the Product resource type picker. * Setting this to undefined will show a badge on draft products. * @defaultValue true */ draft?: boolean | undefined; /** * Whether to show [archived products](https://help.shopify.com/en/manual/products/details?shpxid=70af7d87-E0F2-4973-8B09-B972AAF0ADFD#product-availability). * Only applies to the Product resource type picker. * Setting this to undefined will show a badge on draft products. * @defaultValue true */ archived?: boolean | undefined; /** * GraphQL initial search query for filtering resources available in the picker. * See [search syntax](/docs/api/usage/search-syntax) for more information. * This is not displayed in the search bar when the picker is opened. */ query?: string; } ``` ### BaseResource * id in GraphQL id format, ie 'gid://shopify/Product/1' ```ts string ``` * variants ```ts Resource[] ``` ```ts interface BaseResource extends Resource { variants?: Resource[]; } ``` ### Resource * id in GraphQL id format, ie 'gid://shopify/Product/1' ```ts string ``` ```ts interface Resource { /** in GraphQL id format, ie 'gid://shopify/Product/1' */ id: string; } ``` ## Resource Picker Return Payload The `Resource Picker` returns a Promise with an array of the selected resources. The object type in the array varies based on the provided `type` option. If the picker is cancelled, the Promise resolves to `undefined` `SelectPayload` ### SelectPayload * SelectPayload Examples ## Preview ![](https://shopify.dev/images/templated-apis-screenshots/admin-extensions/2025-04/resource-picker.png) ### Examples * #### Product picker ##### Default ```js const {resourcePicker} = useApi(TARGET); const selected = await resourcePicker({type: 'product'}); ``` * #### Alternate resources ##### Description Alternate resources ##### Collection picker ```js const selected = await resourcePicker({type: 'collection'}); ``` ##### Product variant picker ```js const selected = await resourcePicker({type: 'variant'}); ``` * #### Product picker with preselected resources ##### Description Preselected resources ##### Default ```js const selected = await resourcePicker({ type: 'product', selectionIds: [ { id: 'gid://shopify/Product/12345', variants: [ { id: 'gid://shopify/ProductVariant/1', }, ], }, { id: 'gid://shopify/Product/67890', }, ], }); ``` * #### Product picker with action verb ##### Description Action verb ##### Default ```js const selected = await resourcePicker({ type: 'product', action: 'select', }); ``` * #### Product picker with multiple selection ##### Description Multiple selection ##### Unlimited selectable items ```js const selected = await resourcePicker({ type: 'product', multiple: true, }); ``` ##### Maximum selectable items ```js const selected = await resourcePicker({ type: 'product', multiple: 5, }); ``` * #### Product picker with filters ##### Description Filters ##### Default ```js const selected = await resourcePicker({ type: 'product', filter: { hidden: true, variants: false, draft: false, archived: false, }, }); ``` * #### Product picker with a custom filter query ##### Description Filter query ##### Default ```js const selected = await resourcePicker({ type: 'product', filter: { query: 'Sweater', }, }); ``` * #### Product picker using returned selection payload ##### Description Selection ##### Default ```js const selected = await resourcePicker({type: 'product'}); if (selected) { console.log(selected); } else { console.log('Picker was cancelled by the user'); } ``` * #### Product picker with initial query provided ##### Description Initial query ##### Default ```js const selected = await resourcePicker({ type: 'product', query: 'Sweater', }); ``` ## Related [APIs - Picker](picker)