# Solved: Dynamic product variants in choice component

**URL:** https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344
**Category:** Ask for Help
**Created:** [July 12, 2020, 2:08am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344 "2020-07-12T02:08:52Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [July 12, 2020, 2:08am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/1 "2020-07-12T02:08:52Z")

</div>

Thanks to the brilliant @Jeff_Hager, we have now successfully implemented a dynamic product variant choice component. It was started from this discussion.

> [@Sizes from one worksheet in choices component of other worksheet](https://community.glideapps.com/t/sizes-from-one-worksheet-in-choices-component-of-other-worksheet/12100/):
>
> I have a worksheet with available sizes from a product. The column is named sizes and it is in this format: S,M,L. I have a form setup (different worksheet named form), where I want customers to make a selection from the choice component. So they would be able to choose either S, M or L and submit that choice in the form. So far I have no clue how to get the available sizes data into the choice component of the form. Tried with relations but somehow that does not work here. Any guidance or h…

Based on this discussion and what Jeff and me worked on in the Sheets, I created an app that you can copy to work on for your own apps.

Basically you need to have:

- A column that contains all sizes, separated by a comma (or you can change the separator in the formula if you have an existing one that is not a comma)

- Determine the max number of different variants for a product and create the appropriate columns to store the size in an array column (e.g: Size 1, Size 2, Size 3, etc.)

- Make another sheet to store the unique variants for all products. I have already solved that thanks to a combination of transpose, arrayformula, trim, split & textjoin.

- Make a relation column in Glide that links the array column to the size array sheet and use that as your choice value.

The link to the app is here: [https://hideous-seashore-9158.glideapp.io/](https://hideous-seashore-9158.glideapp.io/)

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/4/427bf7463e16734776d908957aee93769704c52b.png) ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/1/12bc2589d1e9e64080c8bc71d643bc42adc1ff54.png)

---

<div class="post-metadata">

### Author: ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)
#### Post date: [July 12, 2020, 4:03am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/2 "2020-07-12T04:03:32Z")

</div>

The next step @ThinhDinh would be to get the value of each product variant.

E.g. The classic problem with a Pizza menu. Most cases, a pizza has 3 sizes (S,M,L) and each one has a different prices.

I had an idea to fix it but reading yours, I’d like to see your solution to improve this.

Gracias!

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [July 12, 2020, 10:35am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/3 "2020-07-12T10:35:54Z")

</div>

I guess I didn’t realize it, but I’ve been doing this (or something very similar) for a while in some of my apps. By using the same basic logic of moving all options to a separate sheet using “UNIQUE” formulas, I can then create a relation to the User Profile and then lookup the user’s specific choices so that only the ones that they’ve added to their profile are available. I use this for employees’ jobs… people at my organization can have more than one job title, so they’re able to add multiple jobs to their profile, then when they’re filling out a form, they have a choice component that only displays their jobs as choices.

> [@raising\_hand\_woman User Profile columns in conditions and columns](https://community.glideapps.com/t/user-profile-columns-in-conditions-and-columns/8093/54):
>
> Figured it out! Created a new sheet with all Jobs listed (used a Unique function that combines and sorts the Jobs columns in the User Profile sheet ---- =sort(UNIQUE(PROPER({‘User Profile’!G2:G;‘User Profile’!H2:H})))). This gives me a column I can use to create a relation from the array of job titles to the UNIQUE column in the Jobs sheet. Once I have that relation done, I can add a Lookup in my other sheet that pulls in the Jobs Relation values. It’s hard to explain but it works!

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [July 13, 2020, 4:45am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/4 "2020-07-13T04:45:47Z")

</div>

Thank you @ThinhDinh for doing the legwork on this one.

---

<div class="post-metadata">

### Author: ![Nocodemobileapp](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nocodemobileapp/32/6721_2.png) [@Nocodemobileapp](https://community.glideapps.com/u/Nocodemobileapp)
#### Post date: [July 13, 2020, 8:57am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/5 "2020-07-13T08:57:26Z")

</div>

Thank you very much. That is what the shoe and shirt shop need it.

---

<div class="post-metadata">

### Author: ![Test\_Test](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/test_test/32/30930_2.png) [@Test\_Test](https://community.glideapps.com/u/Test_Test)
#### Post date: [December 24, 2021, 9:47am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/6 "2021-12-24T09:47:56Z")

</div>

> [@ThinhDinh](#):
>
> [https://hideous-seashore-9158.glideapp.io/](https://hideous-seashore-9158.glideapp.io/)

Hi @ThinhDinh,  
Is this link dead?  
Thanks  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/c/3/c35e350cdf20993dc66cc1a07151750358986c9e.png)

---

<div class="post-metadata">

### Author: ![Alessandra\_Gavagni](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alessandra_gavagni/32/9479_2.png) [@Alessandra\_Gavagni](https://community.glideapps.com/u/Alessandra_Gavagni)
#### Post date: [December 24, 2021, 7:53pm UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/7 "2021-12-24T19:53:36Z")

</div>

Si ! Yes

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [December 24, 2021, 11:56pm UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/8 "2021-12-24T23:56:59Z")

</div>

Yeah, this thread was 1 and a half years ago, I think I removed that app to clear my dashboard. Sorry for the inconvenience.

---

<div class="post-metadata">

### Author: ![Wolverine](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/wolverine/32/38035_2.png) [@Wolverine](https://community.glideapps.com/u/Wolverine)
#### Post date: [January 25, 2022, 5:01pm UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/9 "2022-01-25T17:01:27Z")

</div>

Anyone know where I can get a working example of this? Trying to figure this out for my grocery shop app.

Thanks!

---

<div class="post-metadata">

### Author: ![Sayam](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sayam/32/44142_2.png) [@Sayam](https://community.glideapps.com/u/Sayam)
#### Post date: [July 4, 2022, 7:56pm UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/10 "2022-07-04T19:56:59Z")

</div>

Hey @ThinhDinh , I really need your help with this!

my app offers different types of food

Example:

Pizza (Options: Extra Cheese, Extra Veggies)  
Ice cream (Options: Cone, Cup)

How am I supposed to assign different choices to different items?

thank you.

Sayam.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [July 5, 2022, 1:06am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/11 "2022-07-05T01:06:41Z")

</div>

If row count is not an issue for you, you can add those options in an extra table and use a multiple-relation/filter for them to use in your choice component.

Something like:

Dish | Option  
Pizza | Extra Cheese  
Pizza | Extra Veggies  
Ice Cream | Cone  
Ice Cream | Cup

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [July 5, 2022, 3:22am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/12 "2022-07-05T03:22:54Z")

</div>

And if row count _is_ an issue, then an alternative is to use a single row per dish, with a joined list of options:

Dish|Options  
Pizza|Extra Cheese, Extra Veggies  
Ice Cream|Cone, Cup

This case is a little more difficult to work with, but will save you rows.

---

<div class="post-metadata">

### Author: ![Sayam](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/sayam/32/44142_2.png) [@Sayam](https://community.glideapps.com/u/Sayam)
#### Post date: [July 5, 2022, 4:14am UTC](https://community.glideapps.com/t/solved-dynamic-product-variants-in-choice-component/12344/13 "2022-07-05T04:14:45Z")

</div>

I would definitely give this a try asap!

Thank you !! I really appreciate it 😁
