On my Shopify store I want to show an HTML banner in a liquid file from 02/01/2022 – 02/14/2022. It’s only for Valentines day orders so I want to auto show the banner just on those dates from the 1st to the 14th.
On my Shopify store I want to show an HTML banner in a liquid file from 02/01/2022 – 02/14/2022. It’s only for Valentines day orders so I want to auto show the banner just on those dates from the 1st to the 14th.
2
Answers
Use a simple if-statement. With
Date()
you get all info that you need.Ensure that
date.getMonth()
is set to 1 for February, since values start with 0.From the Spotify liquid documentation, you can create a conditional code path using the code snippet below:
This code will only show the banner within the specified timeframes. You can try it out on the Liquid editor here: https://liquidjs.com/playground.html