Redirecting customer to same page after logout in shopify store

Aashish Kasma|2/3/2018, UTC|1 MIN READ|
Play
//Redirecting customer to same page after logout in shopify store

Share


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.

 

<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>

Aashish Kasma

Looking for

Development

Solutions?

Lets Discuss

Why Lucent...

innovatio

Learning

Learning comes not only with training but it comes as we facilitate the learning of the organization as well as individuals and the clients continuously refurbishing ourselves.

innovatio

Innovation

We believe in Innovation and have started our company based on that concept. When you don't transform you become stagnant.
Innovation arrow Transformation
arrow Growth.

innovatio

Team Work

We work efficiently as a team. We self-monitor. We deliver results efficiently with the help of multiple perspectives and skill sets. We form strong working relationships as we communicate well with each other.

Lucent innovation
We are a family filled with talented experts that help global brands, enterprises, mid-size businesses or even startups with innovative solutions.
Newsletter
Accelerate your tech projects with us. Get in touch with us.
Follow us
facebooklinkedinyoutubeinstagramtwitter
lucent innnovation: cltuch

Lucent Innovation, © 2023. All rights reserved.Privacy policyDMCA compliant image