Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/minimum order quantity does not apply #3350

Open
wants to merge 1 commit into
base: stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions resources/js/src/app/components/item/QuantityInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default {
}
else
{
diff = formatFloat(value % this.compInterval, this.compDecimals, true);
diff = formatFloat(value % this.compInterval, this.compDecimals, false);
}

if (diff > 0 && diff !== this.compInterval)
Expand All @@ -294,7 +294,7 @@ export default {
}

// cut fraction
value = formatFloat(value, this.compDecimals);
value = formatFloat(value, this.compDecimals, false);

if (value !== this.compValue)
{
Expand All @@ -312,7 +312,9 @@ export default {
if (!isNullOrUndefined(this.min) && this.variationBasketQuantity >= this.min && this.variationBasketQuantity !== 0)
{
// set the minimum value to the interval, if the item is already in the basket
this.compMin = this.compInterval;
if (Number.isInteger(this.compMin)) {
this.compMin = this.compInterval;
}
}
else if (this.variationBasketQuantity === 0)
{
Expand Down
3 changes: 3 additions & 0 deletions resources/js/src/app/helper/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,8 @@ export function formatFloat(value, decimals, round)
// return NaN
return 1 / 0;
}

value = Math.floor(value * 100) / 100;

return parseFloat(value.toFixed(decimals));
}