Retrieve guests orders using email and order ID

Topic summary

A developer is building an order tracker for their Hydrogen storefront that allows customers to look up orders using email and order ID.

Proposed Solution:

  • Create a custom Shopify app to query customers by email using the Admin REST API
  • Retrieve all orders belonging to that customer
  • Filter and display order details matching the provided order ID

Implementation Approach:

  • Store the API access token securely in environment variables (ENV)
  • Use Hydrogen’s loader/action functions, which run server-side (backend)
  • This prevents exposing the API token to the frontend while safely fetching data
  • Pass the retrieved data to the Hydrogen storefront page for display

Key Technical Detail:
Since Hydrogen is built on Remix, developers have full control over both frontend and backend, enabling secure API key management and server-side data fetching.

The discussion provides links to Shopify’s documentation on customer search endpoints, retrieving customer orders, and fetching third-party data in Hydrogen. Further support is available through direct contact if needed.

Summarized with AI on November 11. AI used: claude-sonnet-4-5-20250929.

I am attempting to build an order tracker on my Hydrogen store

The order tracker should take an email and an order ID and then use those values to find the corresponding order

const response = await fetch(`https://${publicDomain}/admin/api/2024-01/orders.json?name=1001}`, {
      method: "GET",
      headers: {
        "X-Shopify-Access-Token": token,
        "Content-Type": "application/json"
      }
    });

I then need to display this order to the customer

Hi @josh_rogers1310 , I think you can do it by creating a custom app to query the customer by email, after that you can retrieve all orders belonging to the customer and display the order details with the corresponding ID. You can send me a message if you need further support: https://weaverse.io/contact.

@Weaverse - thank you for your reply

Would you be able to elaborate a bit more please on my hydrogen storefront would ‘reference’ or speak to the app. As the app is what has more access than the hydrogen build how do I safely perform a FETCH from within the app without exposing the API token and then pass that data returned in to a page on my hydrogen storefront?

Any further help, advice or examples would be much appreciated

When using Hydrogen, which is a framework based on Remix, you have complete control over both the frontend and the backend. You can securely store the API key in the ENV and then use it in the loader/action function, which runs from the backend. This ensures that all fetch actions are safe and secure.
You can read more about fetching external data here: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/third-party