Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Recently Shopify released the ability to create Metafield Definitions for a List of Values. The content of these metafields is an iterable and accessed via the value property.
This works for most of the new content types. However some of the content types return either null or throw an internal error.
I've put together an exhaustive table of all the metafield list types and whether they work property or are broken. The code below the table can be used to recreate the issue. (with appropriately created metafield definitions)
list.weight (bug: meta.value throws internal error) list.volume (bug: meta.value throws internal error) list.dimension (bug: meta.value throws internal error) list.page_reference (bug: meta.value is null) list.rating (bug: meta.value throws internal error) list.date (works) list.date_time (works) list.number_integer (works) list.number_decimal (works) list.product_reference (works) list.single_line_text_field (works) list.color (works) list.file_reference (works) list.url (works)
<!-- # WORKING EXAMPLES - where metafield.value returns a list of values list.single_line_text_field: json: {{ product.metafields.specs.textsingle_list.value | json }} el: {{ product.metafields.specs.textsingle_list.value[0] | json }} str: {{ product.metafields.specs.textsingle_list | prepend: "" }} # FAILING EXAMPLES - where metafield.value returns either null or throws an error list.page_reference: json: {{ product.metafields.specs.pageref_list.value | json }} el: {{ product.metafields.specs.pageref_list.value[0] | json }} str: {{ product.metafields.specs.pageref_list | prepend: "" }} list.rating_list: json: {{ product.metafields.specs.rating_list.value | json }} el: {{ product.metafields.specs.rating_list.value[0] | json }} str: {{ product.metafields.specs.rating_list | prepend: "" }} -->
<!-- # WORKING EXAMPLES - where metafield.value returns a list of values list.single_line_text_field: json: ["cat","dog"] el: "cat" str: ["cat","dog"] # FAILING EXAMPLES - where metafield.value returns either null or throws an error list.page_reference: json: "" el: null str: ["gid://shopify/OnlineStorePage/88645664920","gid://shopify/OnlineStorePage/91070595224"] list.rating_list: json: Liquid error: internal el: Liquid error: internal str: [{"scale_min":"0.0","scale_max":"5.0","value":"1.0"},{"scale_min":"0.0","scale_max":"5.0","value":"3.0"}] -->
Converting the entire metafield to a String via prepend "" was done to show that the metafield is in fact not empty. Unfortunately this is not useful when actually trying to iterate over the metafield contents.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024