How to add the products with sale badge in a collection

Hi,

Could you please advise how to Add all the products that have a badge percentage discount more than 60% OFF in a single collection

Hey @hmurrar

If you’re on Shopify Plus, you can use Shopify Scripts to dynamically group products with a discount greater than 60% into a collection.

Steps:1. Write a script to calculate the discount percentage based on the original and discounted prices.

  1. Use the script to tag products or automatically add them to a collection.

OR

Use Shopify’s Automated Collection (Preferred for Simplicity)

Shopify does not have a built-in option to filter products by discount percentage in the admin. However, you can achieve this by using a tag.

Steps:1. Tag Products with Discounts Over 60%:

  • Go to the Products section in your Shopify Admin.
  • Calculate the discount percentage for your products manually (or use a bulk editor tool or app).
  • Add a tag (e.g., 60-off) to products with discounts greater than 60%.
  1. Create an Automated Collection:

    • Go to Products > Collections in your Shopify Admin.
    • Click Create Collection.
    • Set the collection type to Automated.
    • Add a condition like:
      Product tag > is equal to > 60-off.
  2. Save the Collection:

    • Name your collection (e.g., “60% Off Deals”).
    • Save it, and the tagged products will automatically populate the collection.

OR

Use Custom Liquid Logic for Dynamic Display

If you cannot tag products manually, you can use Liquid code to dynamically display products with a discount over 60% on a custom page.

Steps:1. Create a New Page Template:

  • Go to Online Store > Themes > Edit Code.
  • Under the Templates folder, create a new template (e.g., page.discount-60.liquid).
  1. Add the Liquid Code:
{% assign discount_collection = '' %}

    {% for product in collections.all.products %}
        {% for variant in product.variants %}
            {% assign original_price = variant.compare_at_price %}
            {% assign current_price = variant.price %}
            
            {% if original_price and original_price > current_price %}
                {% assign discount_percentage = 100 | minus: (current_price | times: 100) | divided_by: original_price %}
                {% if discount_percentage > 60 %}
                    - {{ product.title }} - {{ discount_percentage | round }}% off
                    
                {% endif %}
            {% endif %}
        {% endfor %}
    {% endfor %}

  1. Assign the Template to a Page**:**
  • Go to Online Store > Pages.
  • Create a new page (e.g., “Big Discounts”).
  • Assign the discount-60 template to the page.

Hi @hmurrar ,

You can easily accomplish this with the assistance of Product Labels. Follow these steps:

Step 1: Install and enable the app.

Step 2: Create a text badge with the variable {discount_percentage}

Step 3: Select the collection where you want to display the label

Step 4: In the Advanced section, set the Discount range from 60% to 100%.

Step 5: In General settings, choose to show on collection pages

Hi @anupam1607 , thanks for your response, I can use only the last solution you provided for created new page.

I did exactly what you have mentioned, but the result was empty page.

Is there any way to create a code to add the tag Automatically for all prodcuts that have 60%Off and above

Hi @Amanda_Fordeer , thanks for your reply, this feacture you have mentioned is available only for PAID Plan