Skip to content

Commit

Permalink
fix: prevent priced freebies discount mismatch with wrong max discoun…
Browse files Browse the repository at this point in the history
…t check
  • Loading branch information
leomp12 committed Sep 17, 2024
1 parent 2165d5d commit 85b57cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion functions/routes/ecom/modules/apply-discount.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,12 @@ ${discountedSkus.map((sku) => `\n${sku}: ${discountPerSku[sku].toFixed(2)}`)}
const addFreebies = () => {
const { value, label } = getFreebiesPreview()
if (value) {
const maxDiscount = Math.min(value, params.amount.total || 0)
addDiscount(
{ type: 'fixed', value },
'FREEBIES',
label
label,
maxDiscount
)
}
}
Expand Down

0 comments on commit 85b57cb

Please sign in to comment.