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

180
Vistas
Using mathematical liquid variable in javascript

I am trying to get a Shopify liquid variable available for use in a javascript:

{% assign gtfs = 39900 | minus: cart.total_price | money %}

Further down in the javascript:

var feedback = '<div class="added-to-cart" id="ajaxify"><p class="ajaxified-cart-feedback ' + success + '">' + html + {{ gtfs | json }} + '</p></div>';

But for some reason it always returns 399,00. It is like it won't accept the math done in the top part when assigning gtfs.

I tried inserting cart.total_price instead in the script (just to check if the variable was present) - which returns the cart value as intended.

But I need to deduct the cart value from 399 and show that amount (to show how much up to free shipping) - e.g. "You are only 172 DKK away from free shipping".

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

0

I think I got it myself. The liquid variable is loaded in the DOM - hence not updated upon add-to-basket, so I will have to look for event listeners.

Thanks.

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