Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

110
Vistas
Shopify Liquid show content based on dates

On my shopify store I want to show a 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.

Any help is greatly appreciated.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

From the Spotify liquid documentation, you can create a conditional code path using the code snippet below:

{% assign start = "2022-01-02" | date: '%s' %}
{% assign end = "2022-02-14" | date: '%s' %}
{% assign today = "now" | date: '%s' %}
{% if  start <= today and today <= end %}
    <h2>Show banner</h2>
{% endif %}

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

about 4 years ago · Juan Pablo Isaza Denunciar

0

Use a simple if-statement. With Date() you get all info that you need.

const date = new Date();

if (date.getDate() > 14 && date.getMonth() === 1 && date.getFullYear() === 2022) {
    document.getElementById('banner').style.display = 'none';
}
<div id="banner">BANNER</div>

Ensure that date.getMonth() is set to 1 for February, since values start with 0.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda