shopifyliquidshopify-templateshopify-liquid

{{ product.metafields.myfields.myfield.updated_at }} | Shopify Liquid | Metafields


I wanted to ask if it is possible to show the time when a metafield was updated using Shopify Liquid. I tried these ways:

{{ product.metafields.myfields.myfield.updated_at }}
{{ product.metafields.myfields.myfield.updatedAt }}

But neither of those work.

I would very hope someone can help me.

Bye!


Solution

  • It is not possible with Liquid. Shopify does not expose the updated_at date of a resource like a Metafield. You get access to the Metafield attributes they figure matter.

    If you absolutely had to know, the long-winded approach would be to render the Metafield ID (not sure you can do that, but you can try anyway), and assuming you got that, you could call an App Proxy with that ID and assuming your App installed in the store had any permissions on the resources assigned the Metafield, you might be able to read the updated_at date using an API call. You could then respond with JSON and do as you wish with that date. Like I said. Long-Winded

    TL:DR; No. You do not get to play with dates on metafield resources.