Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda