{% comment %}
Renders Price on product grid item
Accepts:
- product: {Object} product (required)
- current_variabt: {Object} Current variant (required)
Usage:
{% render 'product-grid-price', product: product, current_variant: current_variant %}
{% endcomment %}
{%- liquid
assign product_price = product.metafields.app--168074346497.min_auto_discounted_price.value | default: product.price
assign product_price_min = product_price
assign product_compare_at_price = product.compare_at_price
assign product_compare_at_price_min = product.compare_at_price_min
if product_price < product.price and product_compare_at_price == 0 or product_compare_at_price == blank
assign product_compare_at_price = product.price
endif
if product_price < product.price and product_compare_at_price_min == 0 or product_compare_at_price_min == blank
assign product_compare_at_price_min = product.price
endif
assign product_price_raw = product_price
assign product_price_min_raw = product_price_min
assign product_compare_at_price_raw = product_compare_at_price
assign product_compare_at_price_min_raw = product_compare_at_price_min
if settings.currency_code_enable
assign product_price_min = product_price_min_raw | money_with_currency
assign product_compare_at_price = product_compare_at_price_raw | money_with_currency
else
assign product_price_min = product_price_min_raw | money
assign product_compare_at_price = product_compare_at_price_raw | money
endif
-%}
{% if product.available or badge_soldout != '' %}
{% if product.price_varies %}
{{ 'products.general.from' | t }}
{% endif %}
{%- if product_price_raw == 0 and product.price_varies == false -%}
{{ 'general.money.free' | t }}
{%- else -%}
{{ product_price_min }}
{%- endif -%}
{% if product_compare_at_price_raw > product_price_raw %}
{{ product_compare_at_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}
{% endif %}
{% if current_variant.unit_price %}
{% capture unit_price_separator %}
/
{{ 'general.accessibility.unit_price_separator' | t }}
{% endcapture %}
{% capture unit_price_base_unit %}
{% if current_variant.unit_price_measurement.reference_value != 1 %}
{{ current_variant.unit_price_measurement.reference_value }}
{% endif %}
{{ current_variant.unit_price_measurement.reference_unit }}
{% endcapture %}
{{ 'products.product.unit_price_label' | t }}
{% if settings.currency_code_enable %}{{ current_variant.unit_price | money_with_currency }}{% else %}{{ current_variant.unit_price | money }}{% endif %}{{ unit_price_separator }}{{ unit_price_base_unit }}
{% endif %}