Hi,
I’m trying to use the new metafields system to output a rank for a product. After seeing the documentation O noticed that I not able to return a number using the Rating Object, for example:
I have a Rating metafield from 1 to 4 with a value of 2 but I wasn’t able to get the returned value.
{{ product.metafields.cafe.rost_level.rating }}
{{ product.metafields.cafe.rost_level.scale_max }}
{{ product.metafields.cafe.rost_level.scale_min }}
Thanks
You need to add the value keyword:
{{ product.metafields.cafe.rost_level.value.rating }}
{{ product.metafields.cafe.rost_level.value.scale_max }}
{{ product.metafields.cafe.rost_level.value.scale_min }}
Not sure why that’s not in the docs. I found it in some sample code.
1 Like
@suburbiaboy - @MPMachado - Thanks for the info (I could not find that documentation anywhere). I now can show the rating in text form. Do you know how to actually show star svg’s or icons to represent this? I know this is probably a loaded question but maybe you have come across an example or 2.
@graphiclux check out the implementation in the Dawn theme, I think that will probably answer your question:
https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L457