$(document).ready(function() { /* HOME E CART SUMARY */ $('.flexy-add-to-cart-custom').on('click', function(){ car = $('.shopping-cart-content'); button = $(this); input = button.parent().find('input[type="number"]') id = button.data('variant-id'); quantity = input.val(); totalPriceWithDiscount = 0; $.ajax({ url: '/cart/add', type: 'post', dataType: 'json', data: { id: id, quantity: quantity, }, success: function (data) { car.text(''); itens = ''; $.each( data.cart.items, function( i, v ) { totalPriceWithDiscount += v.totalPriceWithDiscount itens += modelCart(v); }); /* Buttons */ itens +='