ton', function(e) { if(window.debug) { debugger; } let $form = $(e.target).getForm(); let data = {'prod_codes':{}, 'extras': {}}; let qty = $form.find('input[name="product_cart_quantity"]').val(); let prodCode = $form.find('input[name="x_remote_prod_code"]').val(); data['prod_codes'][prodCode] = qty; data['extras'][prodCode] = {}; for(let extra of document.querySelectorAll('input:checked[name^="product_extra_options["')) { let key = extra.name.substring(22, 54); data['extras'][prodCode][key] = 1 } let product_name = $form.find('input[name="product_name"]').val(); let sku = $form.find('input[name="product_sku"]').val(); let product_price = $form.find('input[name="product_price"]').val(); console.log(data); Phpr.showLoadingIndicator({form: $form, loadIndicator: Phpr.options.loadIndicator}); $.ajax({ url: basketUrl + '/add/', type: 'POST', crossDomain: true, xhrFields: { withCredentials: true }, headers: { 'X-Requested-With': 'XMLHttpRequest' }, data: data, success: function (response) { dataLayer.push({ 'event' : 'add_to_cart', 'ecommerce' : { 'items': [{ 'item_id': sku, 'item_name': product_name, 'price': product_price, 'quantity': $('#product_cart_quantity').val() }] } }); Phpr.hideLoadingIndicator({form: $form, loadIndicator: Phpr.options.loadIndicator}); if(response.redirect) { window.location.href = response.redirect; } }, error: function (xhr, status) { Phpr.hideLoadingIndicator({form: $form, loadIndicator: Phpr.options.loadIndicator}); } }); }); } }) ";s:8:"ls-cache";i:1757166487;s:6:"ls-ttl";i:3600;}