Hi I am on symmetry theme and I want to replace the word “Sale” to instead show the percentage off
Website is cartolinanantucket.com - attaching image,
thank you!
Hi I am on symmetry theme and I want to replace the word “Sale” to instead show the percentage off
Website is cartolinanantucket.com - attaching image,
Hello @jn10 ,
Find the existing code location.
Remove/Comment existing code.
And use this one
{%- unless product.price_varies == false and product.compare_at_price_varies %}
{%- assign percent = compare_at_price | minus: price | times: 100 | divided_by: compare_at_price | round -%}
{{ percent }}% off
{%- endunless -%}
Note: Make sure do necessary changes in the code a/to the theme you are using.
Regards
Guleria
Hi - where would this be located? I am using symmetry theme
Hi @jn10
I hope you are well.
Please go to your theme and share with me the screenshot of this code part from your theme:
This code might be located in “price.liquid” file, “product.liquid” file, or “main-product.liquid” file. You can find it in any of 3 files I shared, we need the source code from the theme to customize it further.
Looking forward to hearing from you soon. Thank you!
Best,
Daisy - Avada Support Team.
Hi @jn10
Could you share your product-block.liquid file of your theme so I can check and give you the code?
Hi Dan - here you go:
{%- liquid
if collection and settings.prod_thumb_url_within_coll
assign product_url = product.url | within: collection
else
assign product_url = product.url
endif
assign product_images = product.media | where: ‘media_type’, ‘image’
if settings.prod_thumb_hover_image and product_images.size > 1
assign show_hover_image = true
else
assign show_hover_image = false
endif
assign cheapest_variant = product.variants | sort: ‘price’ | first
-%}
{% if settings.quickbuy_style == ‘button’ %}
{% unless no_quick_buy %}
{{ ‘products.quick_buy.launch’ | t }}
{% endunless %}
{% endif %}
{%- if settings.prod_thumb_show_subtitle and product.metafields.descriptors.subtitle != blank -%}
{% if settings.prod_sold_out_show and product.available == false %}
{{ ‘products.labels.sold_out’ | t }}
{% elsif settings.prod_pre_order_label_show and product.template_suffix contains ‘preorder’ %}
{{ ‘products.product.preorder’ | t }}
{% elsif settings.prod_sale_show and cheapest_variant.compare_at_price > cheapest_variant.price %}
{{ ‘products.labels.sale’ | t }}
{% endif %}
{% render ‘unit-price’, variant: cheapest_variant %}
{%- if settings.prod_thumb_show_options -%}
{%- liquid
assign option_limit = 3
assign options_to_show = settings.swatch_option_name | append: ‘,’ | append: settings.prod_thumb_options_names | replace: ', ', ‘,’ | split: ‘,’
-%}
{%- for product_option in product.options_with_values -%}
{%- if options_to_show contains product_option.name -%}
{%- liquid
if settings.swatch_enabled and settings.swatch_option_name contains product_option.name
assign is_swatch = true
else
assign is_swatch = false
endif
-%}
if settings.prod_thumb_options_disable_unavailable
assign is_unavailable = true
for variant in product.variants
if variant.available and variant.options[product_option_position_0index] == product_option_value
assign is_unavailable = false
break
endif
endfor
else
assign is_unavailable = false
endif
if is_swatch and settings.swatch_method == ‘image’ and option_value_variant.featured_media == blank
continue
endif
-%}
<span class=“product-block-options__item{% if is_unavailable %} product-block-options__item–unavailable{% endif %}{% if forloop.index > option_limit and is_swatch %} product-block-options__item–truncated{% endif %}{% if is_swatch %} lazyload{% if manual_image_load %}–manual{% endif %}{% endif %}”
data-option-item=“{{ product_option_value | escape }}”
{% if option_value_variant.featured_media %}data-media=“{{ option_value_variant.featured_media.id }}”{% endif %}
{% if is_swatch %}
{%- if settings.swatch_method == ‘standard’ -%}
data-swatch=“{{ product_option_value | replace: '”', ‘’ | downcase }}"
{%- elsif settings.swatch_method == ‘image’ and option_value_variant.featured_media -%}
data-bgset=“{{ option_value_variant.featured_media.preview_image | img_url: ‘48x48’, crop: settings.swatch_crop_align }}”
{%- endif -%}
{% endif %}>{{ product_option_value }}
{%- endfor -%}
{%- if product_option.values.size > option_limit and is_swatch -%}
{%- assign remaining = product_option.values.size | minus: option_limit -%}
{{ ‘collections.general.more_swatches’ | t: count: remaining }}
{%- endif -%}
{%- endif -%}
{%- if settings.enable_product_reviews_collection and product.metafields.reviews.rating_count != blank -%}
{%- assign rating_count = product.metafields.reviews.rating_count | plus: 0 -%}
{%- if rating_count > 0 -%}
{%- if settings.quickbuy_style != ‘off’ -%}
{%- unless no_quick_buy_markup or no_quick_buy -%}
Please replace this line of code.
{{ 'products.labels.sale' | t }}
With this code
{%- assign percent = cheapest_variant.compare_at_price | minus: cheapest_variant.price | times: 100 | divided_by: cheapest_variant.compare_at_price | round -%}
{{ percent }}% OFF
Hi @jn10
I’m not sure if you received my message.
Looking forward to hearing from you soon. Thank you!
Best,
Daisy - Avada Support Team.
Thank you Dan!
Happy I could help!
Best regards,
Dan from Ryviu