How to Add a table in collapsible row in Shopify

In this tutorial we will learn How  to Add a table in collapsible row in Shopify product page.

Go to the product template and add the following code in the collapsible row block as shown in below screenshot.

{“type”: “checkbox”,
“id”: “istable”,
“label”: “Is this data is a table?”,
“default”: false
}

in the product template and add the following code in the collapsible row  case as shown in below screenshot.

{% if block.settings.istable %}
<table style=”margin:10px”>
{% assign rowarray = block.settings.content | split: “|” %}
{% for row in rowarray %}
<tr>
{% assign columns = row | split: “:” %}
{% if forloop.index0 == 0 %}
{% for column in columns %}
<th>{{ column }}</th>
{% endfor %}
{% else %}
{% for column in columns %}
<td>{{ column }}</td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
</table>
{% else %}
{{ block.settings.content }}
{{ block.settings.page.content }}
{% endif %}