Using the product_reference metafield to type to get product URL?

Hi,

I have a metafield which relates to the standard edition of a product. I am using the product_reference metafield type. The string output for the product_reference metafield is a string using a Global ID. I can use the metafield_tag filter to create a wrapped element but this doesn’t allow you to add classes and automatically uses the product title as the text.

I want to use my own text “Standard Edition” and include a specific class.

Is there a way to pull the URL from the product using the product_reference metafield? I’d rather use the product_reference metafield instead of the url metafield.

Hi @Max11 , If you have the product you should just be able to access the product.url property.

I haven’t checked but see if the metafield_tag accepts additional parameters like the other html filters such as link_to_type or forms tags accept html attribute parameters

Yeah, I’ve tried accessing the product.url property through the metafield with the product_reference metafield type and it just doesn’t seem to work, comes up blank. I’ve tried using link_to_type and it throws up a liquid error on page.