Shopify / shopify-app-bridge

https://shopify.dev/docs/api/app-bridge
82 stars 9 forks source link

Resourcepicker: How do I display all variants of a given ProductId? #197

Closed Jarvie789 closed 4 months ago

Jarvie789 commented 1 year ago

Describe the feature you’d like

// How do I display all variants of a given ProductId? Thanks in advance! <Resourcepicker resourceType="ProductVariant" initialQuery="productId:'gid://...'" ... /> // Dont Work...

dmhenry commented 1 year ago

Hi Jarvie127,

Are you trying to show the product with all variants, or just the variants separately? If you intend to show the product with all variants, you can pass in the id with the resourceType="Product".

ResourcePicker

Jarvie789 commented 1 year ago

Hey, dmhenry @dmhenry Thanks, I want to show only variants individually. I have read the documentation in great detail and searched for relevant content, but I still haven't found any documentation that is helpful to me.

dmhenry commented 1 year ago

@Jarvie127

I believe I was able to achieve your desired result. The ids in initialQuery are the individual variant ids.

<ResourcePicker
  open
  resourceType="ProductVariant"
  selectMultiple
  initialQuery="id:40255900844122 OR id:40255900876890 OR id:40255900909658"
/>
Jarvie789 commented 1 year ago

@dmhenry Hey, man. It still doesn't work. I tried to remove the single or double quotes but it didn't work.

<ResourcePicker
  open
  resourceType="ProductVariant"
  selectMultiple
  initialQuery="id:'gid://shopify/ProductVariant/44877928268057' OR id:'gid://shopify/ProductVariant/44877928333593'"
/>
dmhenry commented 1 year ago

@Jarvie127 I'm sorry this isn't working. Would you try this, please?


<ResourcePicker
  open
  resourceType="ProductVariant"
  selectMultiple
  initialQuery="id:44877928268057 OR id:44877928333593"
/>
charlesdobson commented 4 months ago

Closing as stale. Please reopen if you're still having an issue!