![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/app/code/Kaliop/AutoUpdateCartAjax/view/frontend/web/js/ |
/* * Copyright (c) 2019 Kaliop Digital Commerce (https://digitalcommerce.kaliop.com) All Rights Reserved. * https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * kaliop_autoupdatecartajax_m2 * tchausson <[email protected]> <[email protected]> */ define([ 'jquery', 'Magento_Checkout/js/action/get-totals', 'Magento_Customer/js/customer-data' ], function ($, getTotalsAction, customerData) { $(document).ready(function () { $(document).on('change', 'input[data-role="cart-item-qty"]', function () { if($(this).val().length > 0) { var form = $('form#form-validate'); $.ajax({ url: form.attr('action'), data: form.serialize(), showLoader: true, success: function (res) { var parsedResponse = $.parseHTML(res); var result = $(parsedResponse).find("#form-validate"); var sections = ['cart']; form.replaceWith(result); /* Minicart reloading */ customerData.reload(sections, true); /* Totals summary reloading */ var deferred = $.Deferred(); getTotalsAction([], deferred); }, error: function (xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); console.log(err.Message); } }); } }); }); });