Shopify themes, liquid, logos, and UX
Hi, I would like to add the sale percentage beside my price on product page only. Could anyone help me? Additionally I want to also swap my discounted price with my old price. Please see photo for reference.
Old layout :
Desired layout:
please try constructionlayers.com
You can try to insert this code in snippets/price.liquid if you are using dawn theme line 126 then it will show like save 11% for me with background
<span style="background-color:red;color:#FFF">
{% if compare_at_price > price %}
{% assign compare_at_price_float = compare_at_price | divided_by: 100.0 %}
{% assign price_float = price | divided_by: 100.0 %}
{% assign price_difference = compare_at_price_float | minus: price_float %}
{% assign discount_percentage = price_difference | divided_by: compare_at_price_float | times: 100.0 %}
<p>Save {{ discount_percentage | round }}%</p> <!-- Prints the rounded percentage saved -->
{% endif %}
</span>
@clayinfo it will need code editing, then it can show like this site
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024