Top

Show the Percentage Saved Automatically

To show the percentage saved automatically, follow these steps:

  1. Duplicate themes, to create a backup copy.
  2. From "Shopify Admin", select Online Store.

    select online store

  3. Select Actions.

    Actions

  4. Select Edit code.

    Edit code

  5. Under "Snippets", select Add a new snippet.

    Add A New Snippet

  6. Name the snippet bold-discount-saved.liquid.

    Name Snippet

  7. Select Create Snippet.

    Select Create Snippet

  8. Copy and paste this code into the snippet:

    <!-- Inserted by Bold Apps - Show discount percentage -->
    {% if product.metafields.inventory.ShappifySale == "true" %}
    {% if product.compare_at_price_min > product.price_min %}
    {% capture discount %}
    {{ product.compare_at_price_max | minus:product.price | times:100 | divided_by:product.compare_at_price_max }}%
    {% endcapture %}
    <span><em>{{ discount }} OFF</em></span>
    {% endif %}
    {% endif %}
    <!-- End Bold Code -->

    Copy/Paste Code

  9. Select Save.

    Select Save

  10. Under "Templates" select product.liquid.

    Note: If your theme contains sections you may find this code within product-template.liquid under "Sections" instead.

    Copy/Paste Snippet

  11. Copy and paste this code into the desired location:
    {% include 'bold-discount-saved' %}

    Note: If placing this on a collection or product page you will want it above the "Img" source.

    Select Save

That's it!

Next Steps:

Blog Posts: