Redirect Shopify customer to specific page after logout

By | April 25, 2018

By default, Shopify redirects the customers to home page after logout. If you want to redirect the customer to show a specific page, there is no built in way to do it. Here is a small script to achieve the same. Save this script at the end of Shopify Admin > Online Store > Themes > Edit Code > Assets > theme.js

This script will work for all the logout links that you may have on the page

$(document).ready( function() {
  $('a[href^="/account/logout"]').on("click", function() {
    $.ajax( $(this).attr('href') )
      .done(function() {
      	// Here you will change the url to whatever page you want to redirect to
      	window.location.href = "/pages/my-shopify-page";
      });
    return false;
  });
});

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1’s and 0’s from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.

Leave a Reply

Your email address will not be published. Required fields are marked *