Skip to content

Commit

Permalink
Merge pull request #88 from bookernath/fix-qty-callback
Browse files Browse the repository at this point in the history
Callback with error on getCartQuantity method
  • Loading branch information
mattolson authored Dec 3, 2018
2 parents 9cf7c26 + 0b4de88 commit eba7741
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export default class extends Base {
*/
getCartQuantity(callback) {
this.getCart({}, (err, response) => {
if (err) {
return callback(err);
}
let quantity = 0;
if (response.length) {
const cart = response[0];
Expand All @@ -38,7 +41,7 @@ export default class extends Base {
const giftCertificateQuantity = cart.lineItems.giftCertificates.length;
quantity = lineItemQuantities + giftCertificateQuantity;
}
callback(quantity);
callback(null, quantity);
});
}

Expand Down

0 comments on commit eba7741

Please sign in to comment.