Skip to navigation

Sending customers to the Subscription Manager at sign-in

On Shopify new customer accounts, send customers to the Subscription Manager after they sign in, and send signed-out customers to sign in first

View as Markdown

Learn how to route customers to the Subscription Manager when your store uses Shopify’s new customer accounts.

With new customer accounts, customers reach the Subscription Manager through a link to its app proxy path, /apps/subscriptions/manage/, usually added to the customer account menu. Ordergroove doesn’t provide a customer account extension, so there’s no Subscription Manager block to add to the account pages. Two things follow from that:

  • After signing in, customers land on their order page, not the Subscription Manager.
  • A customer who isn’t signed in and selects a Subscription Manager link on your storefront can land on an error page instead of the sign-in page.

Both fixes below use Shopify’s sign-in path, /customer_authentication/login, with a return_to parameter that sends the customer to a page of your choice once they’ve signed in. Shopify only accepts relative paths in return_to. See Shopify’s guide to customer sign-in links and redirects for details.


Before you start

You’ll need:

  • A store that has switched to new customer accounts, with a Subscription Manager link in the customer account menu. The Shopify New Customer Accounts article in the Knowledge Center covers both.
  • Access to your theme’s code. In the Shopify admin, go to Online Store > Themes, open the menu next to your theme, and select Edit code.

Both changes edit theme files directly, so we recommend duplicating your live theme and testing on the copy before you publish.


Send customers to the Subscription Manager after they sign in

This change applies to Horizon themes, where the header’s account button is a <shopify-account> element.

  1. Open snippets/header-actions.liquid.

  2. Find the <shopify-account> element.

  3. Add a sign-in-url attribute that points to the sign-in path, with the Subscription Manager as the return_to value. If the element already has a sign-in-url, replace its value. Leave the other attributes as they are:

    snippets/header-actions.liquid
    <shopify-account
    menu="{{ customer_account_menu }}"
    sign-in-url="/customer_authentication/login?return_to={{ '/apps/subscriptions/manage/' | url_encode }}"
    {% if account_actions_style != blank %}
    style="{{ account_actions_style }}"
    {% endif %}
    >
  4. Save the file.

To test it, sign out of your storefront, sign in from the account button in the header, and confirm you land on the Subscription Manager.

If your theme isn’t Horizon, find wherever its header builds the sign-in link and point that link at the same URL: /customer_authentication/login?return_to= followed by the URL-encoded Subscription Manager path.


Send signed-out customers to sign in first

This script loads only for signed-out visitors. When one selects a link whose path starts with /apps/subscriptions, the script cancels the click and sends them to the sign-in page instead, with the link’s path and query string as the return_to value. After they sign in, Shopify takes them to the page they were trying to open.

  1. Open layout/theme.liquid.

  2. Paste the following just before the closing </body> tag:

    layout/theme.liquid
    {% unless customer %}
    <script>
    document.addEventListener('click', (event) => {
    const origin = event.composedPath()[0];
    const link = origin && origin.closest ? origin.closest('a[href]') : null;
    if (!link) return;
    const url = new URL(link.href, location.origin);
    if (!url.pathname.startsWith('/apps/subscriptions')) return;
    event.preventDefault();
    event.stopPropagation();
    location.href = '/customer_authentication/login?return_to='
    + encodeURIComponent(url.pathname + url.search);
    }, true);
    </script>
    {% endunless %}
  3. Save the file.

To test it, sign out of your storefront, select a Subscription Manager link, and confirm you’re taken to sign in and then to the Subscription Manager.

The script only handles links selected on your storefront. A customer who opens a Subscription Manager URL directly, such as from an email, isn’t redirected. In emails and other off-site messages, link to the sign-in path with return_to instead.