I’m trying to retrieve the highest price variant from a product to make cross-selling function.
The code below retrieves the lowest priced variant.
How can I retrieve the highest priced variant from a product using reference product metafield?
{% assign refer_product = product.metafields.myfields.related_product.value %}
{% assign productName = refer_product.title %}
{% assign productHandle = refer_product.handle %}
{% if related_product != blank %}
{% endif %}
Recommended Products
{{product.metafields.myfields.related_products}}
{{productHandle}}
{{productName}}
{{refer_product.featured_image |img_url}}
{{refer_product.price | money }}