When Click on View and Edit cart button from Mini-cart,

It will redirect to checkout/cart page. And sometimes after 1 second it will automatically redirect to customer/account/login.

When i try to debug more with it, i found one ajax call gives me 401 status code & i found one js file in vendor in that written code like if status code 401 comes then it will redirect to login page.

Js File : vendor/magento/module-checkout/view/frontend/web/js/model/error-processor.js

Please find attached image of Console. enter image description here

Can any one explain me, why it gives 401 response status code?

  • 1
    I was getting same issue before and fixed it by changes on js file but I don't know why it gives 401 response status code, please check my ans if you want to fix that issue. – Aasim Goriya Jan 11 at 6:50
  • ok, Thanks for your replay dear. But i want to fix the issue not want to bend it. – Nauman m. Mansuri Jan 11 at 6:53

If you need to fix that error then please follow below steps.

First of all Copy your default.js (/vendor/magento/module-checkout/view/frontend/web/js/model/cart/totals-processor/default.js) file from core to your theme directoy e.g. /app/design/frontend/[YOUR_CUSTOM_THEME]/Magento_Checkout/web/js/model/cart/totals-processor/default.js

Then comment this code errorProcessor.process(response); approx line no : 60

}).fail(function (response) {
      /* Comment this code */
}).always(function () {

Please check and let me know if any issue.

  • Dear i know with this Redirect to login will disable, But i need to know Why status code 401 comes. – Nauman m. Mansuri Jan 11 at 7:01
  • That's I don't know why ;) – Aasim Goriya Jan 11 at 8:18
  • When I was getting this issue, I had found something like session_regenerate_id calls multiple time if any custom OPC extension used or any customization in checkout, hope this may help you to figure out the issue regarding 401 error – Aasim Goriya Jan 11 at 8:32
  • @Naumanm.Mansuri did you get the solution ? – Aasim Goriya Jan 11 at 10:47
  • No sir, still not found the solution. – Nauman m. Mansuri Jan 12 at 5:23

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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