Knowledge.ToString()

Redirect Shopify Customer to Specific Page After Logout

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

Comments

3 responses to “Redirect Shopify Customer to Specific Page After Logout”

  1. Rishabh Avatar
    Rishabh

    Got exactly what I was looking for.

    Thanks.

  2. René Avatar
    René

    Ref https://www.vishalon.net/blog/shopify-redirect-customer-to-page-after-logout

    what would be the link to stay on the current page

  3. René Avatar
    René

    Thank you for your tip

Leave a Reply

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