Redirecting Customer to Same Page After Logout in Shopify Store
Shopify · User Experience

Redirecting Customer to Same Page After Logout in Shopify Store

Shopify merchants often face the challenge of being redirected to the homepage after logout. Here we offer a simple solution to auto-redirect customers back to the same page or a specific collection page. By adding a small jQuery script, you can easily achieve this desired functionality and enhance the user experience on your Shopify store.

1 Minute readFebruary 3, 2018Ashish KasamaListen
Shopify User Experience

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script>
$(document).ready( function() {
$('a[href^="/account/logout"]').on("click", function() {
$.ajax( $(this).attr('href') )
.done(function() {
/* Here you can perform required things to achieve  i.e. redirect to specific url, reload same page*/
window.location.reload();
});
return false;
});
});
</script>


This feature was requested by several Shopify merchant to auto-redirect to the same page.

Shopify is redirecting customers to homepage or landing page or index page after logout.

But as requested by several clients, We have played with code and achieve a very simple way to redirect the customers to same page or specific collection page,

Just add this simple line of text to achieve this, We are assuming that jquery is already added by most of the themes.

 

 

SHARE

facebooktwitterwhatsapplinkedin
Ashish Kasama
Ashish Kasama
Co-founder & Your Technology Partner

Ready to Build Something Great?

Lucent Innovation designs and builds production-grade solutions for enterprise and ecommerce teams. Let's talk about your next project.