New Shopify Certification now available: Liquid Storefronts for Theme Developers

Redirect after Shopify Logout

Shopify Partner
6 0 0

Hello Shopify Community!


I'm implementing an authentication system on the headless side by controlling cookie data. I log in on the Shopify account page, and it redirects to our headless site, and it saves cookie data.
I made the logout link in the headless side, and its link is When I click this link, I removed cookie data, and redirects to this link, then it is logged out of Shopify store.
But after logout, it automatically redirects to I just want to redirect to the custom domain, like So it is an external link.
Are there any solution for this? Like the redirect after login. We can redirect to custom page after Shopify login using the following link. I want this kind of solution for logout or any other solutions.
Thank you in advance.
Replies 3 (3)
Shopify Partner
3 0 0

you can use this in theme.liquid before end the body tag
$(document).ready( function() {
$('a[href^="/account/logout"]').on("click", function() {
$.ajax( $(this).attr('href') )
.done(function() {
window.location.href = "/cart";
return false;

3 0 0

I would like to redirect users to two different urls depending on the link selected. I've been trying to work out a way to pass a condition to your script, which others have shared, but can't come up with a way to do it. Any ideas?

1 0 0

I used the following method
<a href="/account/logout?return_url=%2Faccount" >Logout</a>