Can't find information going from Rest to GraphQL

In my shop, I offer a sample pack which customers can choose 4 different choices. I was able to get this information in the Rest API under the order transactions. It just gave me all four variants in a string that I was able to easily split and structure the information how I wanted it.

I’ve been starting to try out the GraphQL API and I can’t find where this information is.

I’m a very beginner developer, just doing this as a hobby. I’m hoping someone with more experience can point me in the right direction.

Hi,
You can go to this page to this page for all document from Shopify for developer: Shopify Developers: Build for millions of merchants
Look at the top nav of the page, there are some sections which related to GraphQL

  • Admin API (GraphQL Admin API reference): which for admin, many function for admin, but caution with limit rate of the API
  • Storefront API (https:// shopify.dev/docs/storefronts): which for you storefront, limit function for storefront: get product,… But the limit rate is high. Remove the space on the link to correct it. Just only add 2 link on a post

Hi MadDriver,

If you haven’t checked it out yet, the GraphiQL app is really helpful for testing out queries and mutations on your store: GraphiQL for the Admin API

Also the .dev Assistant on the dev docs will let you generate GraphQL queries and mutations based on prompts you provide:


In the example you provided, you’d want to query the order object, which has a field for lineItems which has a node which lets you fetch product and variant data. This query would look something like this:

query GetOrder {
  order(id: "gid://shopify/Order/123456789") {
    id
    name
    lineItems(first: 10) {
      edges {
        node {
          id
          title
          variant {
            id
            title
            price
          }
        }
      }
    }
  }
}

If you test this in your instance of the GraphiQL app with a valid order ID you should be seeing the variant IDs and titles being returned.