Build pre-auth order status UI extensions
In this tutorial, you'll create two separate customer account UI extensions, with each using different targets to demonstrate the available authentication flows:
- An order action menu item that opens a modal and prompts the customer to add a note to their order after logging in.
- An extension on the Order status page that displays how many loyalty points were earned from the purchase, in a card at the top of the order summary.


Anchor to What you'll learnWhat you'll learn
In this tutorial, you'll learn how to do the following tasks:
- Use the
authenticationState
API to get the authorization context of a customer. - Create an order action menu extension that opens a modal and uses the seamless login method to trigger customer authentication.
- Create an extension that's rendered inline on the Order status page and uses the
requireLogin
API to trigger customer authentication.
Requirements
-
You've created a Partner account.
-
You've created a new development store with the following:
Project
Anchor to Create a customer account UI extensionCreate a customer account UI extension
To create a customer account UI extension, you can use Shopify CLI, which generates starter code for building your extension and automates common development tasks.
-
Navigate to your app directory:
Terminal
cd <directory> -
Run the following command to create a new customer account UI extension:
Terminal
shopify app generate extension --template customer_account_ui --name customer-account-ui-extension -
Select a language for your extension. You can choose from TypeScript, JavaScript, TypeScript React, or JavaScript React.
TipTypeScript or JavaScript is suitable for smaller projects that require a more straightforward API. TypeScript React or JavaScript React is suitable when you want an easy model for mapping state updates to UI updates. With JavaScript or TypeScript, you need to map state updates yourself. This process is similar to writing an application targeting the DOM, versus using
react-dom
.You should now have a new extension directory in your app's directory. The extension directory includes the extension script at
src/index.{file-extension}
. The following is an example directory structure:Customer account UI extension file structure
└── my-app└── extensions└── my-customer-account-ui-extension├── src│ └── CustomerAccount.jsx OR CustomerAccount.js // The index page of the customer account UI extension├── locales│ ├── en.default.json // The default locale for the customer account UI extension│ └── fr.json // The locale file for non-regional French translations├── shopify.extension.toml // The config file for the customer account UI extension└── package.json
-
Start your development server to build and preview your app:
Terminal
shopify app devTo learn about the processes that are executed when you run
dev
, refer to the Shopify CLI command reference. -
Press
p
to open the developer console. In the developer console page, click on the preview link for your extension.
Anchor to Set up the target for your extensionSet up the target for your extension
Set up the target for your customer account UI extension. Extension targets control where your extension renders in the customer account flow.
This example code uses the following targets:
In your extension's shopify.extension.toml
configuration file, for each of the targets, create an [[extensions.targeting]]
section with the following information:
target
: An identifier that specifies where you're injecting code into Shopify.module
: The path to the file that contains the extension code.
Whenever you edit your extension configuration file, you need to restart your server for the changes to take effect.
Anchor to Create files for your targetsCreate files for your targets
Create files in your extension's src
directory for each of your targets.
In this example, you'll create a file for the order action menu item extension and a file for the order action modal extension. The filenames must match the module
paths you specified.
Now you'll render the Add note order action button. The button isn't being passed a to
or onPress
prop. This is how we know to connect this button to the order action modal extension.

Anchor to Build the modal's UIBuild the modal's UI
Use CustomerAccountAction
to extend the target. Here, you'll use Form
, TextField
, and Button
components to add a note to the order.
Customer account UI extensions are limited to specific UI components exposed by the platform for security reasons. You can use checkout UI components and customer account UI components to create a UI that feels seamless within the customer accounts experience, and that inherits a merchant's brand settings.

Anchor to Make an API call to store the order note once the customer is logged inMake an API call to store the order note once the customer is logged in
The example code uses a comment line to mock the adding note request call. In a production-ready application, make an API call to your server.
Anchor to Preview the extensionPreview the extension
Preview your extension to make sure that it works as expected.
Anchor to Start your serverStart your server
Run the Shopify CLI dev
command to build your app and preview it on your development store.
-
In a terminal, navigate to your app directory.
-
Either start or restart your server to build and preview your app:
Terminal
shopify app dev -
If prompted, select a development store.
-
Press
p
to open the developer console. -
In the developer console page, click the preview link for one of your extension targets.
The customer accounts experience opens.
-
Ensure that you're logged out.
-
Copy the URL of Order status page from a recent order confirmation email, and paste it to the browser directly to be taken to the pre-auth Order status page, where your extension will render.
-
Click the Add Note button, and you will be redirected to the login page.
-
After you login, you will see the modal opened automatically where you can leave a note.


To test extensions in pre-authenticated state, the customer shouldn't be logged in. Copy and paste the URL of the Order status page from the order confirmation email is the best way to test it.
By default, the URL is valid for five uses or two weeks after the order is placed, whichever limit is reached first. If the URL expires, you will need to place a new order to receive a new one.
Anchor to Inline extension on the ,[object Object], page, and ,[object Object]Inline extension on the Order status page, and requireLogin
requireLogin
Anchor to Repeat Step 1 to create a new customer account UI extensionRepeat Step 1 to create a new customer account UI extension
Anchor to Set up the target for your extensionSet up the target for your extension
Set up the target for your customer account UI extension. Extension targets control where your extension renders in the customer account flow.
The example code uses customer-account.order-status.block.render
to render a card in the order summary on the Order status page.
In your extension's configuration file, for the customer-account-order-status-block-render
target, create an [[extensions.targeting]]
section with the following information:
target
: An identifier that specifies where you're injecting code into Shopify.
module
: The path to the file that contains the extension code.
Whenever you edit your extension configuration file, you need to restart your server for the changes to take effect.
Anchor to Create files for your targetsCreate files for your targets
Create files in your extension's src
directory for each of your targets.
In this example, you'll create a file for the order status block extension. The filenames must match the module
paths you specified.
Anchor to Order status block extensionOrder status block extension
Anchor to Render loyalty points cardRender loyalty points card
Using UI extension components, add a card to the Order status page to let the customer know how many loyalty points they've earned for the order.
Anchor to Use the ,[object Object], API to direct the customer to loginUse the requireLogin
API to direct the customer to login
requireLogin
API to direct the customer to loginAnchor to Determine the authentication state with the ,[object Object], APIDetermine the authentication state with the authenticationState
API
authenticationState
APIUsing the authenticationState
API to get the current Order status page authentication state. You'll use this later in the tutorial.
Anchor to Render pre-authenticated state contentRender pre-authenticated state content
The extension adds a View rewards link to the card. Use the requireLogin
API to direct the customer to login when the link is clicked. This method routes the customer back to the Order status page. The customer will need to re-initiate the action after they're logged in.

Anchor to Render fully authenticated state contentRender fully authenticated state content
In this example, the number of points is hardcoded.

Anchor to Preview the extensionPreview the extension
Preview your extension to make sure that it works as expected.
Anchor to Start your serverStart your server
Run the Shopify CLI dev
command to build your app and preview it on your development store.
-
In a terminal, navigate to your app directory.
-
Either start or restart your server to build and preview your app:
Terminal
shopify app dev -
If prompted, select a development store.
-
Press
p
to open the developer console. -
In the developer console page, click the preview link for one of your extension targets.
The customer accounts experience opens.
-
Place an order, if you haven't already.
-
Click View your order from the order confirmation email to access the pre-authenticated Order status page. Don't log in.
-
Click the View rewards link, and you will be redirected to the login page.
-
After you login, you will be redirected back to the Order Status page and see your points balance.


To test extensions in the pre-authenticated state, click View your order from the order confirmation email to access the pre-authenticated Order status page. Don't log in.
By default, the URL only works for 5 times and within 2 weeks. So if the URL is expired, you need to create a new order to get a new URL.
Anchor to Tutorial complete!Tutorial complete!
Nice work - what you just built could be used by Shopify merchants around the world! Keep the momentum going with these related tutorials and resources.
Anchor to Next StepsNext Steps
Explore extension placement options and make informed decisions on where to position them.
Learn about localizing your customer account UI extensions for international merchants and customers.
Learn about the extension targets offered for customer accounts.
Follow our UX guidelines for customer accounts to ensure a consistent and satisfying user experience.
Learn about the components you can use to build customer account UI extensions.
Learn about the checkout components you can use to build customer account UI extensions.
Learn about the difference between each authentication state on the Order status page.