Product picker while creating extension using Polaris/App Bridge

Product picker while creating extension using Polaris/App Bridge

agandhicb
Shopify Partner
10 1 0

Hi,

 

I have created discount app function using documentation, Now I want to extend and want to add Product picker, So I can select products for which that discount would be applied.

I have used Resource Picker but after products are selected, How we can get Product ids and where can save that product ids? Can anyone help please?

agandhicb_0-1705673913880.png

 

Reply 1 (1)

Liam
Shopify Staff
2807 310 805

Hi Agandhicb,

 

Once you have the product picker set up and products are selected, you'll need to handle the selection event to get the product IDs. Here's a general overview of the steps you'll need to take:

  1. Handle the Selection Event: When products are selected using the Resource Picker, an event is triggered. You need to handle this event to get the selected product data.

  2. Extract Product IDs: The event data will include information about the selected products. You'll need to parse this data to extract the product IDs.

  3. Store the Product IDs: After extracting the product IDs, you'll need to decide where to store them. Common options include a database associated with your app, or Shopify's metafields if you want to store the information directly in the Shopify store.

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog