For the past days I have been trying to insert a table into the metafield of a collapsible row on my product page.
I have already created my collapsible rows, and in order to pull product specific information, I have already managed to connect dynamic source in the row content.
I have looked at several solutions posted here already as well as trying to insert the JSON code as other community members have recommended, however the code is displayed, rather than the table itself.
I would also like it to be dynamic enough to resize between desktop and mobile.
Hello @3enny , Can you please share the store URL? Also, please share your code for the collapsible rows using meta fields, It will help me to understand the issue better.
Thanks for sharing the details. But to help you in this I’ll also need the code of this section.
Can you please share the code you have used for the table section?
{% if product.metafields.custom.sizechart2.value.size > 0 %}
{% for row in product.metafields.custom.sizechart2.value %}
{% if row.size == 1 %}
{% for col in row %}
{% endfor %}
{% else %}
{% for col in row %}
{% endfor %}
{% endif %}
{% endfor %}
{{ col | last }}
{{ col | last }}
{% endif %}
And as per the instructions I can now use the snippet in my product template using the following code (I’m not sure where the following code should be pasted, and this is lilely where I am coming into trouble):
I have then returned to online store editor to add a metafield to the product page. Customize → Product → Default products
When I follow Add block > Collapsible row > Row Content > Connect dynamic source > Current Template Product (and nothing is displayed *Note the SIZE tab shown is related to the metafield already created. The metafield called Sizechart2 containing the JSON code from the previous steps is not available to select.)
The Meta-field option for Sizechart2 is not showing in the theme options because the Meta-field type is JSON and the content you are adding in the theme option is a Rich-text type. Still, you can add the data of the Meta-field using some custom code below:
Open the Shopify Theme Editor and paste the below code into the “main-product.liquid” file:
Find the “{%- when ‘collapsible_tab’ -%}” and add the code in the condition as shown in the screenshot.
Thanks for taking the time to offer your solution.
I have no problem inserting the code as per the first 2 steps.
Unfortunately when it comes time to inserting the third piece of code, I am unable to as me product section does no allow me to insert the code as I do not have a Custom Liquid field to paste it.
Is there a way to add tables to collapsible row like this example Product Details Tab? I’ve tried creating a section and adding it into snippet and adding the snippet, creating a metafield, render another section, etc.
Absolutely, no luck . Any help would be greatly appreciated .