{% comment %} Parameters: - product {Object} - Product object. - show_currency_code {Boolean} - Use 'money_with_currency' instead of 'money'. - show_labels {Boolean} - Show Sale/Sold Out labels (optional, default is false). - for_variant_picker {Boolean} - Uses variant price and markup for display of all variant states (optional, default is false). - current_variant {Object} - Current variant, if for_variant_picker is true. Usage: {% render 'price', product: product %} {% endcomment %} {%- liquid assign variant = current_variant | default: product.variants | sort: 'price' | first if for_variant_picker if current_variant == false assign available = true endif else assign for_variant_picker = false assign available = variant.available | default: false endif assign compare_at_price = variant.compare_at_price assign price = variant.price | default: 1999 comment start yagi code endcomment assign target = variant assign price = target.metafields.app--168074346497.auto_discounted_price.value | default: target.price if target.metafields.app--168074346497.discount_type.value != nil and target.metafields.app--168074346497.discount_type.value != "fixed" and product.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: product.metafields.app--168074346497.discount_percentage.value if target.metafields.app--168074346497.discount_percentage.value > 0.01 assign deducted_percentage = 1.0 | minus: target.metafields.app--168074346497.discount_percentage.value endif assign price = target.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil assign compare_at_price = target.price if target.compare_at_price > compare_at_price assign compare_at_price = target.compare_at_price endif endif if price < target.price and compare_at_price == blank assign compare_at_price = target.price endif comment end yagi code endcomment -%}
{%- if product.price_varies -%} {%- if for_variant_picker == false -%} {{ 'products.product.from' | t }} {%- elsif for_variant_picker and current_variant == false -%} {{ 'products.product.from' | t }} {%- endif -%} {%- endif %} {%- if show_currency_code -%} {{ price | money_with_currency }} {%- else -%} {{ price | money }} {%- endif -%} {% if for_variant_picker or compare_at_price > price -%} {%- if compare_at_price > price -%} {{- compare_at_price | money -}} {%- endif -%} {%- endif -%}
{% if show_labels %} {% if settings.prod_sold_out_show and product.available == false %} {{ 'products.product.sold_out' | t }} {% elsif settings.prod_pre_order_label_show and product.template_suffix contains 'preorder' %} {{ 'products.product.preorder' | t }} {% elsif settings.prod_sale_show and variant.compare_at_price > variant.price %} {{ 'products.product.sale' | t }} {% endif %} {% endif %} {% if for_variant_picker or variant.unit_price_measurement %}
{{ 'products.product.price.unit_price' | t }} {{ variant.unit_price | money }} {{ 'products.product.price.unit_price_separator' | t }} {%- if variant.unit_price_measurement.reference_value != 1 -%} {{- variant.unit_price_measurement.reference_value -}} {%- endif -%} {{ variant.unit_price_measurement.reference_unit }}
{% endif %} {% if for_variant_picker %} {% endif %}