Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
I'm really struggling with metafields. I've set up all of my products, metafields and content in the product section of my Shopify admin. 2 of those metafields are description and tasting notes, and I want those to appear as text on each product page, dynamically populated by whatever is in those fields in the admin section under that product. When I set up a text block and click on the dynamic content icon (3 discs), some of the metafields (namely the two mentioned above that I want to have as text on the product page) aren't there in the dropdown as an option to select. I'm wondering if I haven't set them up properly? I have tried deleting them and reentering them, and checking their set up vs the ones that are showing, but I can't seem to see anything wrong. Can anyone help?
Hi Kaiya,
Thanks for your help on this! I've attached a screenshot of all of the metafields I have set up (there are two descriptions metafields because I played around with different configurations, but neither are showing). the second attachment is the description metafield in case there is something wrong within the actual metafield.
I think I’ve sorted it now, thanks so much for your help!
I have not checked for myself but my best guess is that your metafield "custom.description" is of type "multi_line_text_field" (aka multi-line text) which might not be compatible with your current theme editor text setting which is of type "inline_richtext" (meaning, no line break or pararaphed allowed, thus not compatible with multi-line text).
Try to, either:
I changed it to single line text and it’s working for what I need, thank you so much for your help! I also need to include a specifications table lower down on the page, ideally dynamically populated from the other 9 metafields I have set up. The only way I can figure out how to do this is to add a page on each of the product pages, and setting up a table manually in the product description box with all of the content in, so each product page shows a different table. Do you know of a better way I could do it?
For the table, adding page metafields for each product can work, and customize the tables in the page description box, yes. Depending on your data, you may be able to combine metaobjects and tablerow object, may be best for maintanability and better code structure, it really depends on your use case, you'd have to dig into those, and it could take a few trial and errors if you're only getting started with liquid.
Cheers
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024