{%- 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 -%}