Skip to main content

Navigation API

The Navigation API lets you navigate between extension routes, other extensions, or host pages within customer accounts. Use this API to build multi-route extensions, link to specific customer account pages, or direct customers to other installed extensions.

The API supports several custom protocols:

  • shopify:customer-account/: Navigates to built-in customer account host pages such as orders or profile.
  • extension://: Navigates within the current extension's routes.
  • extension://<handle>: Navigates to a different installed extension by its handle.

  • Build multi-page extensions: Use extension:// routes to create extensions with multiple views, such as a subscription management page with a settings sub-page.
  • Link to customer account pages: Navigate customers to built-in pages like order details or profile settings using the shopify:customer-account/ protocol.
  • Connect related extensions: Deep-link from one extension to another using extension://<handle> when workflows span multiple extensions.
Support
Targets (24)

The global navigation object provides navigation functionality for customer account extensions. Access the following properties on the navigation object to navigate between pages, manage history, and handle navigation events.

(type: "currententrychange", cb: (event: ) => void) => void
required

Registers a listener that fires whenever the current navigation entry changes, such as when the buyer navigates to a different page.

required

The current navigation history entry, representing the page the buyer is viewing. Only available in full-page extensions.

required

Navigates to a URL, updating any provided state in the history entries list. Supports custom protocols for navigating within customer accounts.

(type: "currententrychange", cb: (event: ) => void) => void
required

Removes a previously registered currententrychange listener.

(options: ) => void
required

Updates the state of the current history entry without triggering a navigation. Use this when the state change is independent of a page transition, such as saving form progress.


  • Use custom protocols instead of absolute URLs: Always use extension://, shopify:customer-account/, or extension://<handle> protocols rather than hardcoded URLs. Custom protocols ensure your extension works across different store domains and environments.
  • Provide a way back: When navigating to sub-routes within your extension, always include a navigation action that lets customers return to the previous view.
  • Listen for navigation events when rendering depends on the route: Use shopify.navigation.currentEntry or listen for currententrychange events to update your UI when the route changes, rather than relying on stale state.

  • The Navigation API can only navigate within the customer accounts surface. It can't redirect to external URLs or the storefront.
  • The extension://<handle> protocol requires the target extension to be installed and active on the store. If the target extension isn't available, the navigation call has no effect.
  • Navigation between extensions doesn't support passing custom data or query parameters beyond what the target extension's URL structure supports.

Was this page helpful?