# How to redirect customers to the previous page instead of the account page with Shopify NCA?

By default, in most of the Shopify themes, customers are redirected to the customer account page right after the login. This creates quite a disruptive experience for the customers during the shopping journey. In this guide, we will help you change this behavior and bring customers back to the right page where they logged in beforehand.

<figure><img src="https://1367962225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAxc1paAgix94BNLrez8%2Fuploads%2Fgit-blob-63675c9279c99f362c8a627e833399e1a13534cd%2Flogin%20sso%20(2).gif?alt=media" alt=""><figcaption></figcaption></figure>

### Video

See this video if you want to see it in action:

{% embed url="<https://go.screenpal.com/watch/cTinDdnl2kR>" %}

### Dive into the theme code

Most of the Shopify themes have a `headers.liquid` file, in this file you search for this block of code. And notice the `routes.account_login_url` , this is the variable that is responsible for redirecting the customer post-login. You can change this behavior by updating the [other variables here](https://shopify.dev/docs/api/liquid/objects/routes).

<figure><img src="https://1367962225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAxc1paAgix94BNLrez8%2Fuploads%2Fgit-blob-757a935795cf3bf08e1499c68949462a7951aaa7%2Fimage%20(504)%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>

### Update the code

All you need to do is change the `routes.account_login_url` to `routes.storefront_login_url` , which means it would take customers back to the page before the customer attempted the login.

<figure><img src="https://1367962225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAxc1paAgix94BNLrez8%2Fuploads%2Fgit-blob-43bb622ad118af1360195aefca2f8eb79c3fbca6%2Fimage%20(506).png?alt=media" alt=""><figcaption></figcaption></figure>

### Result

As you can see in the result, the customer is redirected back to the cart page with ease and no longer needs to exit the account page, go to checkout anymore. Voila!

<figure><img src="https://1367962225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FpAxc1paAgix94BNLrez8%2Fuploads%2Fgit-blob-cdf69967d2b2dc7345a16e078134751d576d5c3b%2Flogin%20sso%20result%20(2).gif?alt=media" alt=""><figcaption></figcaption></figure>
