Development discussions around Shopify APIs
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 🙏
I have the same issue!
User | RANK |
---|---|
58 | |
11 | |
7 | |
6 | |
6 |
Thanks to all who participated in our AMA with 2H Media on planning your 2023 marketing bu...
By Jacqui Mar 30, 2023Thanks to all Community members that participated in our inaugural 2 week AMA on the new E...
By Jacqui Mar 10, 2023Upskill and stand out with the new Shopify Foundations Certification program
By SarahF_Shopify Mar 6, 2023