Shopify themes, liquid, logos, and UX
I Have this code that display a percentage saved.
But if i have a variant with a diffrent price or compraed price, the number percantage wont update.
how can i make it update based on the variant?
{%- when 'price' -%} <div class="{{ spacing_classes }}" style="--custom-margin-bottom: {{ block.settings.margin_bottom }}px" {{ block.shopify_attributes }}> <div class="product-price-size--{{ block.settings.price_font }} product-price-group"> <span class="visually-hidden">{{ 'products.general.sale_price' | t }}</span> <span style="color:#fff;background-color:#000;border-radius:20px;padding:0 7px;margin-left:4%;font-weight:bold;font-size:15px;margin-bottom:5px; height: 25px"> {% if product.compare_at_price_max > product.price %} SAVE {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}% {% endif %} </span>
Hi @orhl1234 ,
We do need to add custom code for this.
Let me know if you need any assistance.
Thank you
i would love to
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025