Customer orders Query

Topic summary

A developer is encountering issues with a Shopify Storefront API query for fetching customer orders. The query successfully retrieves basic order information (ID, currency code, total price) but fails when attempting to include product details (title and images) from line items.

Key Problem:

  • When the commented-out lineItems section is uncommented to fetch product titles and images, the entire query returns null (customer: null)
  • The query works fine with only basic order fields

Troubleshooting Attempted:

  • Developer tried alternative approaches but the issue persists
  • The problematic fields are specifically within the nested lineItems > variant > product structure

Response:
Another user (Liam) asks whether the app has the unauthenticated_read_product_listings access scope, suggesting this may be a permissions issue preventing access to product data.

Status: Awaiting confirmation on access scopes; issue remains unresolved.

Summarized with AI on November 13. AI used: claude-sonnet-4-5-20250929.
query getCustomersOrders($accessToken: String!) {
    customer(customerAccessToken: $accessToken) {
      orders(first: 10) {
        edges {
          node {
            id
            currencyCode
            # lineItems {
            #   edges {
            #     node {
            #       variant {
            #         product {
            #           title
            #           images(first: 1) {
            #             edges {
            #               node {
            #                 url
            #               }
            #             }
            #           }
            #         }
            #       }
            #     }
            #   }
            # }
            totalPrice {
              amount
            }
          }
        }
      }
    }
  }

in the above storefront API query everything that is requested is returned except for the fields that are commented out. The problem is if I include them (uncomment them) then the entire query returns null (customer: null). I also tried a different way

query getCustomersOrders($accessToken: String!) {
  customer(customerAccessToken: $accessToken) {
    orders(first:10) {
      edges {
        node {
          lineItems{
            edges{
              node{
                variant{
                  title
                  image{
                    url
                  }
                }
              }
            }
          }
          id
          currencyCode
          totalPrice{
            amount
          }
        }
      }
    }
  }
}

but still I doesn’t resolve the main issue. Can anyone please guide me how can fetch the product title and image alongside the other requested order info???

Hi Shah911,

Does your app have the unauthenticated_read_product_listings access scope?