2

After Logout it is taking 5 seconds to redirect to Homepage.

I want to reduce those time to 2 seconds.

How can I achieve this one ?

Thanks.

6

Copy this file :

\vendor\magento\module-customer\view\frontend\web\js\logout-redirect.js

to

\app\design\frontend\Vendor\Theme\Magento_Customer\web\js\ogout-redirect.js

change

$($.mage.redirect(data.url, 'assign', 5000));

to:

$($.mage.redirect(data.url, 'assign', 2000));

Run this command : php bin/magento c:f

I hope this will help you.

If answer is true than accept it and mark it. So it will help to other people.

| improve this answer | |
  • Any idea about, for which purpose it's used the 5 second redirect time? why they can not redirect on homepage without this timeout. – Camit1dk Aug 11 at 4:41
  • @Camit1dk, 5 seconds is default value set by magento. If you want to decrease time, you can use milliseconds like 500. – Chirag Parmar Sep 3 at 1:21
1

override vendor/magento/module-customer/view/frontend/web/js/logout-redirect.js to app/design/frontend/<Vendor>/<Theme>/Magento_Customer/web/js/logout-redirect.js and add below code

define([
    'jquery',
    'mage/mage'
], function ($) {
    'use strict';

    return function (data) {
        $($.mage.redirect(data.url, 'assign', 2000));
    };
});

After override hit below commands

php bin/magento setup:static-content:deploy -f
php bin/magento ca:cl
php bin/magento ca:fl

please do not change directly in the core module because when you upgrade Magento then these changes automatically removed.

| improve this answer | |
0

You need to change in logout-redirect.js

define([
    'jquery',
    'mage/mage'
], function ($) {
    'use strict';

    return function (data) {
        $($.mage.redirect(data.url, 'assign', 2000));
    };
});

and change the message from logout.phtml

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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