Open Order

Navigates the user directly to their order history page within the app.

Description

The openOrders() action is a navigation helper that directs the user to the "My Orders" section. This is particularly useful for post-purchase flows, "Track Order" buttons in custom blocks, or customer support interfaces where the user needs quick access to their purchase history.

Function Signature

await Superfans.actions.openOrders()

Structure of Response

StatusResponse
Success{ "status": "success", "message": "Orders page opened successfully" }
Cart not accessible{ "status": "error", "errorId": 400, "errorHandle": "orders page -not-accessible", "message": "Cart not accessible at the moment, please try again" }
Unexpected Error{ "status": "error", "errorId": 500, "errorHandle": "unknown-error", "message": "Something unexpected happened" }

Example Usage

async function handleOpenOrders() {
  await Superfans.actions.openOrders();
}

Best Practices

  1. Authentication Check: Since order history is private, ensure the user is logged in using Superfans.variables.customer before calling this action to ensure a smooth transition.
  2. Call to Action: Use this on "Thank You" pages or profile dashboards to reduce friction for customers looking for status updates.

Caveats

  1. Session Required: If the user’s session has expired or they are logged out, this action may redirect them to the Login/Authentication screen instead of the Orders page, depending on your store’s configuration.
  2. Sync Delay: In some cases, there may be a slight delay between a successful checkout and the order appearing in the list returned by this view due to Shopify/e-commerce platform sync times.

Did this page help you?