0

When the customer clicks on the submit button on the last page of the checkout in Magento 2, the screen grays out and the loader starts. Before finishing the request, the screen goes back to normal and magento hides the loader. Many times, the customer thinks that the order has been processed, but the request still requires another 2-3 seconds before it's fully executed.

I want to know how I can keep the loader active until the request is fully executed.

2 Answers 2

3

I found a solution.

Open vendor/magento/module-checkout/view/frontend/web/js/action/set-payment-information.js and find:

return storage.post(
    serviceUrl, JSON.stringify(payload)
).fail(
    function (response) {
        errorProcessor.process(response, messageContainer);
    }
).always(
    function () {
        fullScreenLoader.stopLoader(); // you need remove this
    }
);

For replace code you can create "preference" for this file in your theme in requirejs-config.js.

1
  • In my website, on the product page configurable products option takes time to load.So i want to display the loader until content load.So how can i implement this code on product page? Commented Jul 17, 2018 at 8:31
0

You can try above,

jQuery.ajax({
    url: url,
    type: 'POST',
    dataType: 'json',
    showLoader: true //use for display loader 
}).done(function (data) {
    return true;
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.