Redirect Shopify Customer to Specific Page After Logout

Category: ShopifyTags: ,

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;
  });
});

Share

3 comments

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

  1. Rishabh says:

    Got exactly what I was looking for.

    Thanks.

  2. René says:

    Thank you for your tip