Shopify js sdk Variant is invalid

Highlighted
New Member
1 0 0

I Faced an issue with JS SDK

 

While Trying to do 

const lineItemsToAdd = [
                          variantId: 'Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8yOTEwNjAyMjc5Mg==',
                          quantity: 1
                        }
                    ];
const shippingAddress = {
                      address1: self.selectedAddress.address1,
                      address2: self.selectedAddress.address2,
                      city: self.selectedAddress.city,
                      company: null,
                      country: self.selectedAddress.country.country_language.name,
                      firstName: 'Bob',
                      lastName: 'Norman',
                      phone: self.selectedAddress.phone,
                      province:  self.selectedAddress.state.state_language.name,
                      zip: '11001'
                    };

await client.checkout.updateShippingAddress(checkoutData.id, shippingAddress);

 let mainCheckoutId = await client.checkout.addLineItems(checkoutData.id, lineItemsToAdd);

 address works find but the 

mainCheckoutId.lineItems = null
userErrors retuns message ="Variant is invalid";

 

i tried many products and all are published to online sale channel  

 

any suggestions please ???

0 Likes