Solved

How to use a metafield in an HTML table cell?

fro
Excursionist
14 1 2

Hello,

 

Consider the HTML table below. How can I use a metafield inside one of the cells so product specific information shows?

 

I have tried using this syntax {{ blabla.my_field.morebla }} but that does not seem work, it just shows that piece of syntax inside the cell and does not interpret it as a metafield.

 

Test1Test2Test3
Case A{{ blabla.my_field.morebla }}2
Case B32
Case C54

 

Kind Regards

Accepted Solution (1)
sakinur-rahman
Shopify Partner
127 16 19

This is an accepted solution.

It’s need add Directly on the product page. Otherwise it Won't work

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications -

Your Coffee Tip and my code, A perfect blend. ❤️ Buy Me A Coffee


Website: HelloSakin.com

View solution in original post

Replies 6 (6)

sakinur-rahman
Shopify Partner
127 16 19

Please use it   product.metafields.my_field.morebla 

 

It will solve the issue. If you will find this message helpful, pls accept it as a solution.

Thank you 

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications -

Your Coffee Tip and my code, A perfect blend. ❤️ Buy Me A Coffee


Website: HelloSakin.com
fro
Excursionist
14 1 2

Thanks for your reply.

I have typed it in the format you have specified. The name of the metafield can be seen below. In the product page I have assigned the value of 10 to it.

 

fro_0-1652561060821.png

 

However, in the HTML table you don't see the value 10, but {{ product.metafields.my_fields.this_is_a_test }}

 

 

 

 

sakinur-rahman
Shopify Partner
127 16 19

@fro  Please refresh properly, sometimes takes to update. it should be worked fine. Also note that it works only in the product page.

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications -

Your Coffee Tip and my code, A perfect blend. ❤️ Buy Me A Coffee


Website: HelloSakin.com
fro
Excursionist
14 1 2

@sakinur-rahman the HTML table is located on a page I created. And that page is dynamically linked to a pop up block (Dawn) on the product page, so when you click the pop up link, the HTML table will appear in a pop up. I refreshed a couple of time but no success.

It's shown in plain text.

 

fro_0-1652562250211.png

 

sakinur-rahman
Shopify Partner
127 16 19

This is an accepted solution.

It’s need add Directly on the product page. Otherwise it Won't work

Need a Shopify developer? Chat on WhatsApp


- For Shopify Design Changes | Shopify Custom Coding | Custom Modifications -

Your Coffee Tip and my code, A perfect blend. ❤️ Buy Me A Coffee


Website: HelloSakin.com

MrL22
Shopify Partner
18 0 12

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/