How can I add a 'New' label to products in the Debut theme?

Morning all, hope everyone is well!

I have recently helped my friend set up his online store using the Debut theme. I am looking to get a label over the newly uploaded albums simply saying “NEW”. i have found a help guide on how to do this is the Supply theme - https://community.shopify.com/c/Technical-Q-A/How-can-I-add-quot-New-quot-Label-to-products-in-Supply-Theme/td-p/480067 but wondered if any one could help me get this to work with the Debut theme. many thanks.

Web site link - www.don-threads.co.uk

Morning

Locate the file “product-price-listing.liquid” you can do so by going to the admin panel and clicking on Actions > Edit Code > snippets > product-price-listing.liquid

Between line 25 and 27 add this

{% assign date_created = product.created_at | date:'%s' %}
{% assign     date_now = 'now' | date:'%s' %}
{% assign   difference = date_now | minus: date_created %}

{% if difference < 2592000 %}
   NEW!
{% endif %}

Hope it helps.

Regards,

Martin

2 Likes

thanks Martin, i have got it working so far. can you help me change the font colour of “NEW” ? also, how long does it display new for? for example if it is over 7 days since i have uploaded it will the “NEW” disappear? many thanks

Kind Regards,

Ashley Pellegrina

It looks like you’ve already figured it out with the colours, at the moment it disappears after 30 days but if you want it disappearing after 7, you can change it from 2592000 to 604800

1 Like

Thanks again Martin, yes i worked out the colour and the time, after remembering it was done in seconds and amended.

Great help thank you.

1 Like

did not work for me. :disappointed_face: