Lifetime product

Solved
FredAz
Tourist
11 1 1

Hi, I'm looking a way to display "new" if a product is in stock for less of 15 days for example, could you please help?

0 Likes
Speedimize
Shopify Partner
168 27 81

Hi @FredAz 

Welcome to Shopify Community. 

Aibek is here from Speedimize.io agency. 

Hope this solution can help you: 

 

 

{% comment %} Product created date by seconds {% endcomment %}
{% assign productCreatedAt = product.created_at | date: '%s' %}
 
{% comment %} Current date by seconds {% endcomment %}
{% assign today = 'now' | date: '%s' %}

{% comment %} Difference in seconds {% endcomment %} 
{% assign diffSeconds = today | minus: productCreatedAt %}

{% comment %} Difference in days {% endcomment %}
{% assign diffDays = diffSeconds | divided_by: 3600 | divided_by: 24 %}
 
{% if diffDays > 15 %}
old product
{% else %}
new product
{% endif %}
 

 

 

 

Where old product and new product are registered, you can insert your own values. For example, the new icon, etc.

We recommend experimenting with a copy of the theme so that there are no downtimes.

 

Kind Regards.

We Speedimize your store
Have a problem with speed performance, send me email here: hello@speedimize.io


If our advice was helpful please LIKE or ACCEPT SOLUTION
FredAz
Tourist
11 1 1
Great ! Works perfectly ! Thanx
0 Likes
Speedimize
Shopify Partner
168 27 81

This is an accepted solution.

So glad to hear that! 

Please, if you don't mind can you please like my post or accept it as a solution.

Thx in advance

We Speedimize your store
Have a problem with speed performance, send me email here: hello@speedimize.io


If our advice was helpful please LIKE or ACCEPT SOLUTION