Graphql how to access product variantID? JS Buy SDK requires it for adding to checkout

Hi,

I’m trying to set up a checkout with the JS Buy SDK.

I’m using a Gatsby front end, using the gatsby-source-shopify 5.1.0 plugin.

In the example below from shopify docs, you can see the checkout requires a variantId to reference the product.

const checkoutId = 'Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0SW1hZ2UvMTgyMTc3ODc1OTI='; // ID of an existing checkout
const lineItemsToAdd = [
  {
    variantId: 'Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8yOTEwNjAyMjc5Mg==',
    quantity: 5,
    customAttributes: [{key: "MyKey", value: "MyValue"}]
  }
];

// Add an item to the checkout
client.checkout.addLineItems(checkoutId, lineItemsToAdd).then((checkout) => {
  // Do something with the updated checkout
  console.log(checkout.lineItems); // Array with one additional line item
});

In my graphql data layer I can only see shopifyId there is no reference to a variantId..

How can I access the variantId?

(the shopifyId is the wrong format: gid://shopify/ProductVariant/40890427080873)

Many thanks :folded_hands:

I have the same issue!