I want to show 9% OFF or SALE in Sale badge
kindly give a solutions to change this text
https://isiro.ca/products/anti-theft-durable-laptop-backpack?variant=39814587810075
I want to show 9% OFF or SALE in Sale badge
kindly give a solutions to change this text
https://isiro.ca/products/anti-theft-durable-laptop-backpack?variant=39814587810075
yes, please share product page code so i will check and update
hello @KetanKumar here are product.liquid file code
============================
{%- if collection == blank and product.collections.first != blank -%}{%- assign collection = product.collections.first -%}{%- endif -%}
{%- case settings.design_products -%}
{%- when ‘2’ -%}
{%- assign singles_wc = ‘nt-single-2’ -%}
{%- when ‘3’ -%}
{%- assign singles_wc = ‘nt-single-3’ -%}
{%- else -%}
{%- assign singles_wc = ‘nt-single-1’ -%}
{%- endcase -%}
{%- case settings.size_img_pr -%}
{% when ‘1’ %}
{%- assign class_images = ‘col-lg-4’ -%}
{%- assign class_summary = ‘col-lg-8’ -%}
{% when ‘2’ %}
{%- assign class_images = ‘col-md-6’ -%}
{%- assign class_summary = ‘col-md-6’ -%}
{% when ‘3’ %}
{%- assign class_images = ‘col-lg-7’ -%}
{%- assign class_summary = ‘col-lg-5’ -%}
{%- endcase -%}
{%- assign page_pr_img_size = settings.use_eq_thumb_height -%}
{%- assign nav_pr_img_size = settings.use_eq_nav_height -%}
{%- assign has_size_guide = false -%}
{%- assign btn_atc_full = false -%}
{%- assign nt_suffix = ‘not_group_images’ -%}
{%- assign first_available_variant = settings.first_available_variant -%}
{%- if product.selected_variant != blank and first_available_variant == false -%}
{%- assign current_variant = product.selected_variant -%}
{%- elsif first_available_variant == false -%}
{%- assign current_variant = product.variants.first -%}
{%- else -%}
{%- assign current_variant = product.selected_or_first_available_variant -%}
{%- endif -%}
{%- assign featured_image = current_variant.featured_image | default: product.featured_image -%}
{%- assign product_image_zoom_size = ‘master’ -%}
{%- assign product_image_scale = ‘2’ -%}
{%- assign cv_color = ‘nt-p-item’ -%}
{%- assign nt_carousel = ‘nt-carousel’ -%}
{%- include ‘nt_check_label’ -%}
{%- if settings.use_wishlist -%}{%- include ‘nitro-wishlist’ -%}{%- endif -%}
{%- if product.metafields.external -%}
{%- assign check = product.metafields.external | first | last -%}
{%- if check contains ‘https:’ or check contains ‘http:’ -%}{%- assign check_external = true -%}{%-else-%}{%- assign check_external = false -%}{%-endif-%}
{%-endif-%}
{%- if settings.show_share_btn and settings.share_type == ‘1’ -%}
{%- assign gl_follow_social = false -%}
{%- elsif settings.show_share_btn and settings.share_type == ‘2’ -%}
{%- assign gl_follow_social = true -%}
{%- endif -%}
{%- assign stock_countdow = true -%}
{%- if settings.gecko_stock_countdown == false -%}
{%- assign stock_countdow = true -%}
{%- elsif settings.gecko_stock_countdown and settings.stock_message == blank -%}
{%- assign stock_countdow = true -%}
{%- endif -%}
{%- assign estimateStartDate = settings.delivery_start -%}
{%- assign estimateEndDate = settings.delivery_end -%}
{%- if product.metafields.meta.estimateStartDate != blank -%}
{%- assign estimateStartDate = product.metafields.meta.estimateStartDate | plus:0 -%}
{%- endif -%}
{%- if product.metafields.meta.estimateEndDate != blank -%}
{%- assign estimateEndDate = product.metafields.meta.estimateEndDate | plus:0 -%}
{%- endif -%}
{%- assign remove_unavailable = true -%}
{%- assign remove_soldout = settings.remove_sold_out -%}
{%- if linklists[product.handle].links.size == 0 -%}
{%- if product.price_varies -%}
{%- if settings.price_format == '1' -%}
{{ product.price_min | money }} – {{ product.price_max | money }}
{%- else -%}
{{ 'products.product.from' | t }} {{ product.price_min | money }}
{%- endif -%}
{%- elsif on_sale -%}{%- assign save = current_variant.compare_at_price | minus: current_variant.price | times: 100.0 | divided_by: current_variant.compare_at_price | ceil -%}{{ current_variant.compare_at_price | money }} {{ current_variant.price | money }} {{ 'products.product.save_js' | t: saved_amount:save }}
{%- else -%}
{{ current_variant.price | money }}
{%- endif -%}
{%- else -%}
{%- if on_sale -%}
{{ product.price | money }}–{{ product.compare_at_price | money }}
{%- elsif product.price_varies -%}
{{ product.price_min | money }}–{{ product.price_max | money }}
{%- else -%}
{{ product.price | money }}
{%- endif -%}
{%- endif -%}
{%- if product.metafields.meta.description_excerpt -%} {{ product.metafields.meta.description_excerpt | strip_html }} {%- elsif product.metafields.global.description -%} {{ product.metafields.global.description | strip_html }} {% elsif product.description contains '[' %} {% assign pr_des = product.description | split: '[' %} {% assign pr_des = pr_des[1] | split: ']' | first | append:']' | prepend:'[' %} {{ product.description | remove: pr_des | strip_html | truncatewords: prodcut_excerpt_length }} {%-else-%} {{ product.description | strip_html | truncatewords: prodcut_excerpt_length }} {%-endif-%}
{{ 'products.product.outofstock' | t }}
{%- endif -%} {%- if check_external -%} {{ product.metafields.external | first | first }} {%- elsif current_variant.inventory_quantity <= 0 and current_variant.available and current_variant.inventory_management == 'shopify' -%} {{ 'products.product.pre_orders' | t }} {%- else -%} {{ 'products.product.add_to_cart' | t }} {%- endif -%}{{ 'products.product.outofstock' | t }}
{{ 'products.product.title_notify_me' | t }}
{{ 'products.product.title_notify_me' | t }}
{%- assign formId = 'ContactForm' -%} {%- include 'form-status', formId,notify_me:'1' -%} {%- if form.posted_successfully? == false -%}{{ 'products.product.outofstock' | t }}
{%- endif -%} {%- else -%} {%- form 'product', product, id: "cart-form", class: "nt_cart_form variations_form product-form nt_cart clearfix" -%} {%- if product.variants.size == 1 and product.has_only_default_variant == false -%}{%- include settings.swatch_design,class_input:'pr',cl_selected:'is-selected' -%}{%- endif -%}| {{ 'products.product.product_share' | t }} | {%- include 'social-sharing', follow_social:gl_follow_social,nt_tooltip:true,class_tooltip:'tooltip_top_right' -%} |
Hi @obaidbadsha ,
You can follow the following steps:
However, this solution is only temporary. If you don’t use labels anymore, you can delete the above script. In case you want to create and use labels/badges easier, I suggest you consider using some 3rd-party app that allows you to create custom labels/badges, or even apply them to each product condition.
I hope that it’s useful to you. Let me know if you need further help.
this code is not working, i want to show SALE text in all of the product badges
kindly help me
Hi @obaidbadsha
The script only changes the existing labels, which meet the original criteria.
If you want the label to apply to products/collections, then I think you should use a 3rd-party app (maybe free or paid) as creating a short script to apply to the entire page seems to be impossible. The 3rd-party app will help you to check the condition of each product/collection/tag/ .. . and a lot of user configs).
thank you for your suggestion, can you suggest an app like this?