{%- liquid assign current_variant = product.selected_or_first_available_variant assign price = current_variant.price assign compare_at_price = current_variant.compare_at_price comment start Yagi app code endcomment assign public_or_tags_matched = true if product.metafields.app--168074346497.segment_tags.value.size > 0 assign public_or_tags_matched = false endif for etag in product.metafields.app--168074346497.segment_tags.value if customer.tags contains etag assign public_or_tags_matched = true break endif endfor if public_or_tags_matched assign price = current_variant.metafields.app--168074346497.auto_discounted_price.value | default: current_variant.price assign compare_at_price = current_variant.compare_at_price if shop.metafields.app--168074346497.discount_percentage.value > 0.005 assign discount_percentage = shop.metafields.app--168074346497.discount_percentage.value | times: 1.0 assign deducted_percentage = 1.0 | minus: discount_percentage assign price = current_variant.price | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil endif if price < current_variant.price and compare_at_price == 0 or compare_at_price == blank assign compare_at_price = current_variant.price endif endif comment end Yagi app code endcomment assign sale_type = settings.badge_sale_type if block.settings.price_size assign price_size_class = block.settings.price_size | prepend: 'accent-size-' assign price_small_class = block.settings.price_size | minus: 1 | prepend: 'accent-size-' endif # Select current selling plan if it's specified in the URL assign selected_selling_plan = product.selected_selling_plan if product.requires_selling_plan # Fallback to the first available selling plan assign selected_selling_plan = product.selected_or_first_available_selling_plan_allocation.selling_plan | default: product.selling_plan_groups[0].selling_plans[0] endif assign sale_text = 'products.product.sale' | t # Subscription price if selected_selling_plan assign sale_text = 'products.product.subscription' | t # Make sure the variant exists(it isn't 'unavailable') and showing a price makes sense if current_variant assign price_adjustment = selected_selling_plan.price_adjustments[0] case price_adjustment.value_type when 'percentage' assign sale_type = 'percentage' assign plan_discount_amount = price | times: price_adjustment.value | divided_by: 100 assign compare_at_price = price assign price = compare_at_price | minus: plan_discount_amount when 'fixed_amount' assign sale_type = 'dollar' assign compare_at_price = price assign price = compare_at_price | minus: price_adjustment.value when 'price' assign sale_type = 'dollar' assign compare_at_price = price assign price = price_adjustment.value endcase endif endif -%}
price %} class="product__price--sale"{% endif %}> {%- if settings.currency_code_enable -%} {{ price | money_with_currency }} {%- else -%} {{ price | money }} {%- endif -%} {% if compare_at_price > price or product.selected_selling_plan %} {% case sale_type %} {% when 'strike' %} {%- if settings.currency_code_enable -%} {{ compare_at_price | money_with_currency }} {%- else -%} {{ compare_at_price | money }} {%- endif -%} {% when 'percentage' %} {% assign difference = compare_at_price | minus: price %} {% assign percent_off = difference | times: 100 | divided_by: compare_at_price %} {{ sale_text }} {% if percent_off > 0 %} {{ 'products.product.save' | t }} {{ percent_off | floor | append: '%' }} {% endif %} {% when 'dollar' %} {% assign amount_off = compare_at_price | minus: price %} {{ sale_text }} {{ 'products.product.save' | t }} {{ amount_off | money }} {% endcase %} {% endif %} {% if current_variant.unit_price != blank %} {% capture show_units %} {%- unless current_variant.unit_price -%}style="display: none;"{%- endunless -%} {% endcapture %} {% capture unit_price_separator %} {{ 'general.accessibility.unit_price_separator' | t }}  {% endcapture %} {% capture unit_price_base_unit %} {% if current_variant.unit_price_measurement %} {% if current_variant.unit_price_measurement.reference_value != 1 %} {{ current_variant.unit_price_measurement.reference_value }} {%- endif -%} {{ current_variant.unit_price_measurement.reference_unit }} {% endif %} {% 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 }} {{ 'products.product.each' | t }}
{% endif %}