assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
Final Edition or –$200 Applied.
Final Edition or –$200 Applied.
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
Final Edition or –$200 Applied.
Final Edition or –$200 Applied.
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
Final Edition – $200 Reduction Applied.
Final Edition – $200 Reduction Applied.
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif
assign product_tags = product.tags | join: ',' | append: ','
assign preorder = false
assign is_preorder_meta = false
assign on_sale = false
assign badge_container_class = 'badge-box-container' | append: ' ' | append: settings.badge_alignment | append: ' ' | append: settings.badge_font_size
assign badge_class = 'badge-box'
assign show_saving = settings.show_saving_badge
if settings.show_preorder_badge
if product.metafields.theme.preorder.type == 'boolean' and product.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if current_variant.metafields.theme.preorder.type == 'boolean' and current_variant.metafields.theme.preorder.value == true
assign is_preorder_meta = true
endif
if product_tags contains '_preorder' or is_preorder_meta
assign preorder_badge_text = 'products.product.pre_order' | t
assign preorder_badge_class = badge_class | append: ' preorder-box'
assign preorder = true
endif
endif
if settings.show_sold_out_badge and product.available == false
assign sold_badge_text = 'products.product.sold_out' | t
assign sold_badge_class = badge_class | append: ' sold-box'
else
if settings.show_custom_badge
if product.metafields.theme.badge != blank and product.metafields.theme.badge.type == 'single_line_text_field'
assign custom_badge_text = product.metafields.theme.badge.value
endif
if custom_badge_text == blank and product_tags contains '_badge_'
assign custom_badge_text = product_tags | split: '_badge_'
assign custom_badge_text = custom_badge_text[1] | split: ',' | first | replace: '_', ' '
endif
assign custom_badge_class = badge_class | append: ' custom-box'
endif
if settings.show_automatic_new_badge and preorder == false
assign product_created_timestamp = product.created_at | date: '%s' | plus: 0
assign days_in_seconds = settings.badge_new_date_limit | times: 24 | times: 60 | times: 60
assign current_date_timestamp = "now" | date: '%s'
assign check_date_timestamp = current_date_timestamp | minus: days_in_seconds
if product_created_timestamp > check_date_timestamp
assign new_badge_text = 'products.product.new' | t
endif
assign new_badge_class = badge_class | append: ' new-box'
endif
if product.compare_at_price > product.price and settings.sale_tags_enable
assign on_sale = true
endif
if on_sale
assign sale_badge_class = badge_class | append: ' sale-box'
assign sale_badge_text = 'products.product.on_sale' | t
endif
if on_sale and show_saving
assign price = current_variant.price
assign price_compare = current_variant.compare_at_price
assign price_difference = price_compare | minus: price
assign test_variants = product.variants | where: 'compare_at_price' | where: 'available', true
assign discount = price_difference | money_without_trailing_zeros
if test_variants.size > 0
for variant in test_variants
assign variant_price_difference = variant.compare_at_price | minus: variant.price
if variant_price_difference > price_difference
assign price = variant.price
assign price_compare = variant.compare_at_price
assign price_difference = variant_price_difference
endif
endfor
endif
if settings.currency_code_enable
assign discount = price_difference | money_without_trailing_zeros | append: ' ' | append: cart.currency.iso_code
endif
if settings.saving_badge_type == 'percentage'
assign percent_off = price_difference | times: 1.00 | divided_by: price_compare | times: 100
assign discount = percent_off | floor | append: '%'
endif
if product.variants.size == 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_html' | t: discount: discount
endif
if product.variants.size > 1 and price_difference > 0
assign sale_badge_text = 'products.product.save_badge_up_to_html' | t: discount: discount
endif
endif
endif