Can I read metafields of a product that is referenced in a LineItem

Hey,

I’m trying to read metafields of a product that is referenced in a LineItem with no luck. Is this possible?

Here is my code. For reference - trying this on the account page.

{% for line_item in order.line_items %}  
{{ line_item.title | link_to: product.metafields.my_fields.product_type.value | url  x{{ line_item.quantity }} 
                
{% endfor %}

Any help is greatly appreciated.

Thank you,

I actually just figured this one out for anyone who is interested. You can reference a metafield from line_item but your code needs to be structured like this:

line_item.product.metafields.your-namespace.your-key.value

And that’s does the trick.