Skip to content

Commit

Permalink
fix(add-product): fix handling max/min quantities
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Aug 18, 2020
1 parent 8418110 commit 07e5f80
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/methods/add-product.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ export default ({ addItem }, emitter, [product, variationId, quantity = 1, canSa
if (!item.picture && product.pictures) {
item.picture = product.pictures[0]
}
item.quantity = item.min_quantity || product.min_quantity || quantity
item.max_quantity = product.quantity
item.max_quantity = item.quantity || product.quantity
const minQuantity = item.min_quantity || product.min_quantity
item.quantity = minQuantity > 0 ? Math.max(minQuantity, quantity) : quantity
item.price = price(item) || price(product)

return addItem(item, canSave)
Expand Down

0 comments on commit 07e5f80

Please sign in to comment.