Skip to main content

Build a subscription link extension

Note

Creation of new Subscription link extensions from the Partner Dashboard is deprecated. If you have an existing Subscription link extension and would like to continue to manage it, please migrate it to Shopify CLI following the migration guide.

You can customize the View subscription link by managing the Subscription link app extension from your app through the Shopify CLI.

Merchants can see the View subscription link on the customer and order pages on Shopify admin. Please reference this guide for more information about how to create a subscription contract.


In this tutorial, you'll learn how to do the following tasks:

  • Create a subscription link extension.
  • Preview and deploy the extension.


Anchor to Step 1: Generate a new extensionStep 1: Generate a new extension

  1. Use Shopify CLI to generate a new extension:

    Terminal

    shopify app generate extension --template subscription_link_extension --name subscription-link --flavor react

    You should now have a new extension directory at extensions/subscription-link.

  2. Navigate to extensions/subscription-link/shopify.extension.toml and make sure the pattern matches your endpoint. This ensures that the View subscription link redirects to the correct endpoint:

    extensions/subscription-link/shopify.extension.toml

    [[extensions]]
    name = "subscription-link"
    type = "subscription_link_extension"
    uid = "6d03b9f2-a131-2fb2-477e-0f5c88a337b3256fe3e4"
    handle = "subscription-link"

    pattern = "/subscriptions{?customer_id,shop}&id={contract_id}"
    Note

    The pattern must match the URL that you want to redirect to. It can be a relative path, or an absolute URL template.

The [[extensions]] array uses the following configuration properties:

  • name: The merchant-facing name of the extension.

  • type: The extension type. For a subscription link extension, use subscription_link_extension.

  • uid:

    The extension user identifier. An app-scoped identifier that shopify app deploy uses to determine whether an extension is being created, updated, or deleted. uid is created and managed by Shopify: it's generated automatically when you scaffold the extension with Shopify CLI, so you don't need to set or edit it manually. It must be unique within the app.

  • handle: The unique internal identifier for the extension. After you create a draft version of the extension, or deploy an extension, you can't change the handle value.

  • pattern: The URL that the View subscription link redirects to. It can be a relative path, or an absolute URL template.


Anchor to Step 2: Preview the extensionStep 2: Preview the extension

To preview the extension, either start or restart your server with the following command:

Terminal

shopify app dev

Anchor to Step 3: Deploy the extensionStep 3: Deploy the extension

Once you're ready to release your app, deploy the extension with the following command:

Terminal

shopify app deploy

Was this page helpful?