I am using this code on the product-card-grid.liquid page:
{% if product.variants.first.weight > 0%}
approx. {{ product.variants.first.weight | weight_with_unit }}
{% endif %}
It works in displaying the weight but it appears as lb instead of kg or g. The items themselves have already been in with a weight of g/kg.
Any help would be greatly appreciated.
Hi @hardatworktom
See the below. According to the Shopify Documentation
variant.weight
Returns the variant’s weight in grams. Use the weight_with_unit filter to convert it to your store’s weight format or the weight unit configured on the variant.
Hi @hardatworktom
Try this may be work
{% if product.variants.first.weight > 0%}
approx. {{ product.variants.first.weight | weight_with_unit: variant.weight_unit}}
{% endif %}
@hardatworktom
indeed, shopify documentation has helped me out in a few sticky situations :P!