Cannot get selectedOptions in variant's LineItem of Orders Graphql Admin

Solved
tuanlead
Shopify Partner
6 0 0

Graphql Admin API, the variant's Line Items is always NULL. I think this is a bug.

x-request-id: c1820a36-c903-4551-a430-3e03298b7396

 

{
  orders(first: 10, query: "created_at:>'2020-06-18T00:00:00+07:00'") {
    edges {
      node {
        name
        shippingAddress {
          address1
          address2
          city
          company
          country
          countryCodeV2
          firstName
          formatted
        }
        lineItems(first: 20) {
          edges {
            node {
              id
              name
              image {
                originalSrc
              }
              quantity
              vendor
              sku
              variantTitle
              variant {
                id
                selectedOptions {
                  name
                  value
                }
              }
            }
          }
        }
      }
    }
  }
}

 

Response

image.png

 

0 Likes
_JB
Shopify Staff
Shopify Staff
750 87 165

This is an accepted solution.

Hey @tuanlead,

This looks to be a permissions issue with the api_client being used. Adding the `read_products` scope to your app will allow the query to return the expected data for the selectedOptions connection.

JB | Developer Support @ 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