Metafields in Accordion - How to show no accordion item when metafields are blank

Hello,

We have ingredients for various products, and we planned on using metafields (Ingredient 1, Ingredient 2, Ingredient 3) to show the key ingredients callouts in an accordion section. However, some items have 5 ingredients, and some have 8 or 10. In order to showcase all 10 ingredients, we need to 10 accordion items. However for the products with only 4 ingredients, then the accordion shows 6 empty spaces. How do we get the accordion section to only show drop downs if the metafields are filled? Ex. 4 ingredients = 4 accordions, 8 ingredients shows 8 accordions.

@lht32423
Add the condition when metafileds are blank or filled. then Show only filled accordian.

Thank you! Do you mind elaborating how I go about adding this condition? I do not see a toggle or any such thing in then UI.

@lht32423

you need to hire a Shopify Developer.

kindly share a reference link and Screenshot. What Exactly you want

Thank you.

Here is a screenshot of a product with 4 meta fields, and you can see the accordion has 8 lines so the extra 4 show blank.

Here is a screenshot of a product with 8 meta fields, so this shows all 8 accordions filled.

Ideally the accordion only shows lines for meta fields with data, so a product with 4 meta fields would look like this:

Here is a link to a page:

https://lifehousetonics.com/collections/adaptogen-blends/products/sunshine-daydream-2-0