Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda