I created a script to insert a div into the cart in my store, but it is giving it an error in the replace function. Would anyone know why?
var $JQuery = jQuery.noConflict();
$JQuery(function(){
var ValorFreteGratis = 299;
var PrecoTotal = '{{order_total}}';
var QuantoFalta = ValorFreteGratis - PrecoTotal;
var NumeroComVirgula = QuantoFalta.replace(".", ",");
if(PrecoTotal < ValorFreteGratis){
$JQuery('<div class="msg-free_shipping"> <p><span class="warning">EI!!:</span> Comprando mais R$' + NumeroComVirgula.toFixed(2) + ' <span class="restante">você aproveita o <strong>FRETE GRÁTIS</strong> nas compras acima de R$<span class="valor-gratis">' + ValorFreteGratis + '</span></p> </div>').insertAfter('form#cart_update_post');}});
You get the error: "Uncaught TypeError: How much is missing is not a function"