Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
¿Cómo actualizar el contenido del mini carrito en Bigcommerce?

Modifiqué el mini-carro (cart-preview.html) en el tema de la piedra angular de la plantilla, el problema es que cuando agrego al carrito o actualizo la cantidad del artículo usando utils.api.cart.itemUpdate(itemId, newQty, (err, response) => {}) el contenido del carrito no se actualiza y tengo que actualizar manualmente toda la página para que aparezcan los cambios.

Muestro los detalles del artículo usando el objeto del cart proporcionado por bigcommerce, por ejemplo:

 <h1>{{cart.items[0].quantity}}</h1>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

 if (cartId) { // Get existing quantity from localStorage if found if (utils.tools.storage.localStorageAvailable()) { if (localStorage.getItem('cart-quantity')) { quantity = Number(localStorage.getItem('cart-quantity')); $body.trigger('cart-quantity-update', quantity); } } // Get updated cart quantity from the Cart API const cartQtyPromise = new Promise((resolve, reject) => { utils.api.cart.getCartQuantity({ baseUrl: secureBaseUrl, cartId }, (err, qty) => { if (err) { // If this appears to be a 404 for the cart ID, set cart quantity to 0 if (err === 'Not Found') { resolve(0); } else { reject(err); } } resolve(qty); }); }); // If the Cart API gives us a different quantity number, update it cartQtyPromise.then(qty => { quantity = qty; $body.trigger('cart-quantity-update', quantity); }); } else { $body.trigger('cart-quantity-update', quantity); }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!