{% assign hideOtherLabelsWhenSoldOut = true -%} {% assign money_format = request.money_format | strip_html -%} {% assign removePriceDecimal = false -%} {% assign showCentAsSuperscript = false -%} {% assign decimalDelimiter = '' -%} {% assign withoutTrailingZeros = true -%} {% assign compareAtPriceMin = product.compare_at_price_min | default: 0 -%} {% assign priceMin = product.price_min | default: 0 %} {% assign yagi_discount_percentage = product | product_metafield: 'yagi.discount_percentage' | plus: 0 %} {% if yagi_discount_percentage > 0.01 %} {% assign compareAtPriceMin = priceMin %} {% assign deducted_percentage = 1.0 | minus: yagi_discount_percentage %} {% assign priceMin = priceMin | divided_by: 100.0 | times: deducted_percentage | times: 100.0 | ceil %} {% endif %} {% if hideOtherLabelsWhenSoldOut != true -%} {% settings if themeSettings.productItems.productImg.elements.productSaleLabel.isEnable %} {% if compareAtPriceMin > priceMin -%} {% assign percent = compareAtPriceMin | minus: priceMin | times: 100 | divided_by: compareAtPriceMin | round -%} {% if yagi_discount_percentage > 0.01 %} {% assign percent = yagi_discount_percentage | times: 100 | ceil %} {% endif %} {% assign salePercent = percent | append: '%' -%} {% assign saleAmount = compareAtPriceMin | minus: priceMin | format_currency: money_format, showCentAsSuperscript, removePriceDecimal, decimalDelimiter, withoutTrailingZeros -%} {% assign productItemSaleTranslated = "productItem.productItemSale" | translate: translations, "Sale" | replace: '{{salePercent}}', salePercent | replace: '{{saleAmount}}', saleAmount -%}