How to add NEW badge to latest products in Shopify

Hura Product Showcase Builder

There are many ways to attach visitor’s attention to a product. One of the most popular ways is by adding a small badge, usually on the top left or right corner of the product image. We’ve all seen this little red circle “Sale” icon near the product container.

This article helps you know how to create a simple “New” icon badge for a product, based on the date the product is published/created in Shopify. It is automatically added and removed from a product after a certain period of time (which we are able to adjust regarding our preferences).

Here’s the liquid code:

You can change days variable to your value. In this case we’ve set it to 7, which equals to 7 days.

Now, what if a product is having 2 or more badges at the same time? For example a “Sale” badge, because its price is reduced and a “New” badge, because it’s newly listed in your store. You can create another simple if statement and organize the order of the badges like so:

You can go ahead and build upon this snippet.

Happy coding!

Hura Theme Blocks

You may also like...

3 Responses

  1. Kora says:

    Hi – Could you confirm with me in which area would this code be included ?

    Kind regards, Kora

  2. John Sherry says:

    Hi, I installed the code in collection-template.liquid, but nothing is showing up when displaying a collection. Any suggestions?, help please.

    Kind regards, John

  3. Barry says:

    Hi, Just wondering where to put this code too.

    Regards,
    Barry

Leave a Reply

Your email address will not be published. Required fields are marked *