Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Customer orders Query

Customer orders Query

shah911
Shopify Partner
1 0 0

 

 

 

  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???

Reply 1 (1)

Liam
Community Manager
3108 344 911

Hi Shah911,

 

Does your app have the unauthenticated_read_product_listings access scope?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog