foodbot-cart-calculations 1.0.53 → 1.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1081,7 +1081,7 @@ function setPackageDefaultDiscount(cart) {
1081
1081
  item.package_items.forEach(function (v) {
1082
1082
  //this commemted code is sceniore when user can also increas item quantity i think which is wrong
1083
1083
  // itemTotal += ((item.quantity * v.quantity) * v.price);
1084
- itemTotal += (item.quantity * v.price);
1084
+ itemTotal += (item.quantity * (v.quantity * v.price));
1085
1085
  })
1086
1086
  let packagePrice = item.quantity * item.item_price;
1087
1087
  let totalDiscount = (packagePrice < itemTotal) ? (parseFloat(itemTotal) - parseFloat(packagePrice)).toFixed(2) : 0;
@@ -1121,7 +1121,7 @@ function distributeDiscount(packageItems, totalDiscount, itemTotal, quantity) {
1121
1121
  for (const [index, item] of packageItems.entries()) {
1122
1122
  //this commemted code is sceniore when user can also increas item quantity i think which is wrong
1123
1123
  // let discountPerItem = (parseFloat(singleUnit) * (parseInt(item.quantity) * parseFloat(item.price))).toFixed(2);
1124
- let discountPerItem = (parseFloat(singleUnit) * parseFloat(item.price)).toFixed(2);
1124
+ let discountPerItem = (parseFloat(singleUnit) * parseFloat(item.price * item.quantity)).toFixed(2);
1125
1125
  totalApplied = (parseFloat(totalApplied) + parseFloat(discountPerItem)).toFixed(2);
1126
1126
  item.default_combo_discount = parseFloat(discountPerItem).toFixed(2);
1127
1127
  if (index == packageItems.length - 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "foodbot-cart-calculations",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "Package for cart calculations in which it performs discount distribution and tax distribution on order",
5
5
  "main": "index.js",
6
6
  "scripts": {