Ecommerce Shopify WordPress Discussion

Shopify metafield json shown as table

I am new to this site and to json and I hope for your assistance. We have a metafield that I would like to show as a table. Json.Format is currently as follows: "f3b77f84-9b4d-4740-b249-bf02c199695e": { "type": "collapsible_text", "settings": { "title": "Eigenschaften", "content": " {{ product.metafields.custom.eigenschaften | metafield_tag }}</p>" The number of lines per product might vary. The final table should look like this as an example: Properties Attributes A: 123444 Attributes B: 789789 etc I very much hope of any hints on how to solve it. Thank you very much in advance. Google research - unfortunately I could not find a hint.
To display the metafield data as a table in JSON format, you'll need to manipulate the content value to generate the table structure. Since you're working with Shopify Liquid syntax within the content field, you can use Liquid's for loop to iterate over the metafield data and format it into a table. Here's how you can modify the content value to generate the table structure: "f3b77f84-9b4d-4740-b249-bf02c199695e": { "type": "collapsible_text", "settings": { "title": "Eigenschaften", "content": " <table> <thead> <tr> <th>Properties</th> <th>Attributes</th> </tr> </thead> <tbody> {% for property in product.metafields.custom.eigenschaften %} <tr> <td>{{ }}</td> <td>{{ property.value }}</td> </tr> {% endfor %} </tbody> </table> " } } Run code snippetExpand snippet In the provided example, I assume that the product.metafields.custom.eigenschaften contains an array of objects where each object represents a property and its corresponding attribute. Here's a breakdown of what's happening in the content value: We use HTML <table>, <thead>, <tbody>, <tr>, and <th> tags to structure the table. Within the for loop, we iterate over each property in product.metafields.custom.eigenschaften. For each property, we create a new table row () with two cells (): one for the property name ( and one for the attribute value (property.value). Make sure to replace and property.value with the actual keys you have in your metafield data. This approach should help you display the metafield data as a table in the desired format.

February 13, 2024

Thank you so much for the coding! I replaced the initial part with your coding while the metafield json format was accepted. However when saving your coding part, I received the following feedback of a bad control character in the line of "content": " It looks like that the " seems to cause an error. Is there a hint how to overcome this... Thanks again so much!!!

February 13, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.