Liquid, JavaScript, themes, sales channels
Hello,
I am using the Dawn 2.0 theme. I have created page with a html table. I have also created a product metafield.
I would like to add this product metafield to one of the cells in this table. Is that possible?
<table width="100%">
<tbody>
<tr>
<td style="width: 35.0423%;">Test1</td>
<td style="width: 26.9577%;">Test2</td>
<td style="width: 31%;">Test3</td>
</tr>
<tr>
<td style="width: 35.0423%;">Case A</td>
<td style="width: 26.9577%;">8</td>
<td style="width: 31%;">2</td>
</tr>
<tr>
<td style="width: 35.0423%;">Case B</td>
<td style="width: 26.9577%;">3</td>
<td style="width: 31%;">2</td>
</tr>
<tr>
<td style="width: 35.0423%;">Case C</td>
<td style="width: 26.9577%;">5</td>
<td style="width: 31%;">4</td>
</tr>
</tbody>
</table>
Hi @fro,
You can get Metafields directly and add to table. For example for Metafields is subtitle
You just need to add the following code where you want to display the Metafields, it will work fine:
{{ product.metafields.my_fields.subtitle }}
Hope it helps!
Unfortunately, this does not seem to work.
I added a text metafield en copied the key/name to the html table in a new page.
Then I added the page as a dynamic source to the collapsible row on the product page.
Hi @fro,
With page content displayed at 'Collapsible content', it would be impossible.
Because page content doesn't support liquid code so if you want to add Metafield you need to create your own field and add code for it, instead of getting a content page.
Hope it is clear to you.
I was looking for a very similar thing to generate tables and ended up developing this free tool which can be implemented easily into your theme. https://webforward.github.io/shopify-tables/
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024