Build a subscription link extension
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.
Anchor to What you'll learnWhat you'll learn
In this tutorial, you'll learn how to do the following tasks:
- Create a subscription link extension.
- Preview and deploy the extension.
Anchor to RequirementsRequirements
- You have a Shopify app with the Shopify CLI version 3.70.0 or above installed.
Anchor to Step 1: Generate a new extensionStep 1: Generate a new extension
-
Use Shopify CLI to generate a new extension:
Terminal
shopify app generate extension --template subscription_link_extension --name subscription-link --flavor reactYou should now have a new extension directory at
extensions/subscription-link
. -
Navigate to
extensions/subscription-link/shopify.extension.toml
and make sure thepattern
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"handle = "subscription-link"pattern = "/subscriptions{?customer_id,shop}&id={contract_id}"NoteThe
pattern
must match the URL that you want to redirect 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
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: