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
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025