I need to add a custom attribute field of type enum. The option values for this enum field should be dynamically fetched from code.
Is it possible? Or is there any other alternative?
I originally want a list of product vendors from shopify, but this type of field is not available, thus I wish to dynamically add it from code.
Hi @olivela, will you please clarify the context where you’d be fetching data, then using it to create an ‘attribute field’?
Here is my scenario:
I have certain section models in builderio which I want to target on certain pages. These pages are product pages for an e-commerce site.
Targeting should include
- Specific categories e.g. If i target category to jewelery, the section will show on product page of type jewelry.
- Specific vendor e.g. If i target vendor to XYZ, the section will show on product page of vendor XYZ.
Currently I don’t see any option to add shopifyVendor type in the targeting attribute. Thus, I had created type ‘enum’ and manually added some vendors in the list.
However, it would be great if we could dynamically update this data from code in the enum list using the vendors we have.
Thanks for describing that!
This isn’t possible now because Custom Targeting Attributes are not powered by dynamic data. It’s certainly possible to fetch data from a parent page and use Dynamic Symbols to pass data about the page (such as vendor data fetched by an API) and determine if the content should be displayed via a
Show If binding.
If you’d like us to consider the addition of dynamic targeting, please submit that feature request at ideas.builder.io.
~Logan from Builder.io