We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Table of contents in a collapsible text

Solved

Table of contents in a collapsible text

kaorimtodd
Tourist
8 0 0

Hi all,
Hoping someone can point me in the right direction.

I created a table of contents that shows product details in a collapsible text section.
See the page https://tokaceramics.com.au/products/shikika-japanese-mortar-black "details."
As you can see (pic 1), I have 3 sizes showing in one line, and it's not neat and hard to read.
Screen Shot 2025-02-12 at 4.32.17 pm.png
Ideally, I'd like it to show like below, where each value has its own line:
- Small: φ12.0cm ×5.0cm
- Medium: φ16.0cm ×7.5cm
- Large: φ19.5cm ×9.0cm

The value is pulled through from metafield, as each product has different sizing, and for this particular one, it's created with multi text.

I recreated the metafield with rich text, but then the value shows unnecessary info (see pic 2).
Screen Shot 2025-02-12 at 4.34.11 pm.png

 

I use the Prestige theme and also contacted them, and they told me to create a page metafield and create a table there, but that's not really working either.

All I want is to be able to show the value exactly the same way when I add it to the product page (pic 3).
Screen Shot 2025-02-12 at 4.41.06 pm.png

 

Hope it all makes sense, and if someone could help me out, that would be much appreciated.

Accepted Solution (1)
Kyle_liu
Shopify Partner
441 55 80

This is an accepted solution.

 

{%- if product.metafields.custom.size.value != blank -%}
                  <div class="rating-wrapper">
                    <pre style="font: var(--text-font-style) var(--text-font-weight) var(--text-base) / 1.65 var(--text-font-family);">{{ product.metafields.custom.size.value }}</pre>
                  </div>
                {%- endif -%}

 

Kyle_liu_0-1739409149286.png

 

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee

View solution in original post

Replies 5 (5)

Kyle_liu
Shopify Partner
441 55 80

Hi  @kaorimtodd 

 

Need to use pre tag

 

 

{%- if product.metafields.custom.size.value != blank -%}
                  <div class="rating-wrapper">
                    <pre>{{ product.metafields.custom.size.value }}</pre>
                  </div>
                {%- endif -%}

 

Kyle_liu_0-1739349633825.png

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee
kaorimtodd
Tourist
8 0 0

Hi Kyle,

Thanks so much for your quick reply!
I tried that, and it works, but could you help me further?
As shown in the picture, the font size is larger than the others on the page.
Is there any way to fix this and make it the same size as the other fonts?
Screen Shot 2025-02-13 at 10.47.27 am.png


Kyle_liu
Shopify Partner
441 55 80

This is an accepted solution.

 

{%- if product.metafields.custom.size.value != blank -%}
                  <div class="rating-wrapper">
                    <pre style="font: var(--text-font-style) var(--text-font-weight) var(--text-base) / 1.65 var(--text-font-family);">{{ product.metafields.custom.size.value }}</pre>
                  </div>
                {%- endif -%}

 

Kyle_liu_0-1739409149286.png

 

 

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me Email Me Buy Me A Coffee
kaorimtodd
Tourist
8 0 0
It worked perfectly! You're a lifesaver, thanks so much! 😊

 

Jrdiamondsco
Visitor
2 0 0

Hi how’s it going ?

im new to this and im actually trying to create a table of contents just like the one you have so i can list it as my product description/details , can you please help me out I want to keep it simple i don’t necessarily have to stack a few sentences on top of each other just 1 for each detail.