Participe do nosso Grupo do WhatsApp e receba todas as nossas News!
5% de desconto no pagamento via Pix
Participe do nosso Grupo do WhatsApp e receba todas as nossas News!
5% de desconto no pagamento via Pix
Compre e receba no mesmo dia, clique aqui!
Filtrar
4 / 5
function preparePrice(price) { price = $.trim(price); price = price.replace('R$', '').replace(/\./g, '').replace(/\,/g, '.'); price = parseFloat(price); var new_price = price - (price * DISCOUNT_PCT); return new_price.toLocaleString('pt-br', { style: 'currency', currency: 'BRL' }); } function ajustPriceShowcase() { try { var $products = $('[data-component="product-list-item"]').not('.is-ok'); $.each($products, function () { var $this = $(this); $this.addClass('is-ok'); var $price = $this.find('.js-price-display'); var price = $price.text(); var new_price = preparePrice(price); $price.before('' + new_price + '' + MENSAGEM_DE_DESCONTO + ''); $price.prepend('ou '); $this.find('.js-max-installments .js-max-installments').prepend('em até '); }); } catch (error) { console.log('Error exec func ajustPriceShowcase', error) } } function ajustPriceProductPage() { try { var $productInfo = $('[data-store*="product-info-"]'); if ($productInfo.length) { var $price = $productInfo.find('#price_display'); var $installments = $productInfo.find('.js-max-installments .js-max-installments'); if ($price.length && $price.text().indexOf(' ou ') < 0) { var new_price = preparePrice($price.text()); if ($('.lb-price-discount-product-page').length) { $('.lb-price-discount-product-page').remove(); } $price.before('' + new_price + '' + MENSAGEM_DE_DESCONTO + ' com ' + DESCONTO_EM_PORCENTAGEM + '% OFF'); if ($installments.text().indexOf('em até ') < 0) { $installments.prepend('em até '); } } } if (!$('body').hasClass('lb-discount-product-init')) { $('body').addClass('lb-discount-product-init'); $(document).on('DOMNodeInserted DOMNodeRemoved DOMSubtreeModified', '.js-product-variants', function () { ajustPriceProductPage(); }); } } catch (error) { console.log('Error exec func ajustPriceProductPage', error) } } ajustPriceShowcase(); ajustPriceProductPage();