Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
Using Shopify JS Buy SDK, unable to remove variant item from cart

I have a button to remove an item from the cart on my cart page, but I'm receiving this error: Variable $lineItemIds of type [ID!]! was provided invalid value.

I've gone through the GraphQL list and tried every single ID, title, and variant, but it still gives me this error. Which ID should I be using and how should I format the ID correctly?

 $('.remove-item').on('click', function() {
    const lineItems = checkout.attrs.lineItems;
    const checkoutId = 'gid://shopify/Checkout/xxxxxxxxxxx';
    var dataid = this.getAttribute('data-id');
    var varid = btoa(lineItems[dataid].variant.id);
    var lineItemsToRemove = [{
        variantId: varid,
        quantity: 1
    }];
    client.checkout.removeLineItems(checkoutId, lineItemsToRemove).then((checkout) => {
    });
});
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After reviewing the documentation, I realized I was adding an id attribute. It should just pass the plain ID.

var lineItemsToRemove = [
    varid2
];

instead of

var lineItemsToRemove = [{
    id:varid2
}];
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda