Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi,
I have a metaobject that contains a list of date time values. I would like these date time values to display on my website as product variants via metafields. The variants dont change price, but the user must select a date time option before checkout.
I have added a liquid code block to the product, but the codes I've tried do not display the correct information
{{product.metafields.hairdresser.availability.value}} returns "MetaobjectListDrop"
{{product.metafields.hairdresser.availability}} returns "["gid://shopify/Metaobject/4145512602"]"
{% for metaobject in product.metafields.hairdresser_profile.values %}
{{ metaobject.availability }}
{{ metaobject.availability.value }}
{% endfor %} does not return anything.
Please help!
Hi @Adina3,
I don't know the entire settings of the metaobject and metafield, so just to give you some guidelines how to use it.
If you're using a list of values, then you need to use the for loop to iterate through all the items in the array. Something like this:
{% for hairdresser in product.metafields.hairdresser_profile.value %}
{{ hairdresser.availability | date: "%a, %b %d, %Y" }}
{% endfor %}
I've recently published an article on how to set up How to display multiple metaobject entries on Shopify?
In the article, you'll find a guide on how to set it up with a real example. Just change the fields (from single line text to date) and you should be able to set it up.
Hope this helps!
I had the same problem, turned out the metaobjects were in "Draft" state.
Change them the "Active" state and your code would work.
In Canada, payment processors, like those that provide payment processing services t...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025