foodbot-cart-calculations 1.0.6-dev.1 → 1.0.7-dev.1
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.
- package/calculations.js +6 -4
- package/package.json +1 -1
package/calculations.js
CHANGED
|
@@ -81,10 +81,7 @@ function applyDistribution(body) {
|
|
|
81
81
|
|
|
82
82
|
let delivery_cost = body.delivery_cost ? body.delivery_cost : 0;
|
|
83
83
|
let service_amount = body.service_amount ? body.service_amount : 0;
|
|
84
|
-
|
|
85
|
-
delivery_cost = Math.max(0, delivery_cost - final.delivery_discount);
|
|
86
|
-
body.delivery_cost = delivery_cost;
|
|
87
|
-
}
|
|
84
|
+
|
|
88
85
|
// Adjust delivery cost based on delivery discount
|
|
89
86
|
if (originalIsDeliveryDiscount) {
|
|
90
87
|
delivery_cost = Math.max(0, delivery_cost - parseFloat(originalDeliveryDiscount));
|
|
@@ -93,6 +90,11 @@ function applyDistribution(body) {
|
|
|
93
90
|
mainCart.order_items.is_delivery_discount = true;
|
|
94
91
|
console.log("✅ Applied delivery discount:", { delivery_cost, body_delivery_cost: body.delivery_cost, order_items: mainCart.order_items });
|
|
95
92
|
}
|
|
93
|
+
|
|
94
|
+
if (final.is_delivery_discount) {
|
|
95
|
+
delivery_cost = Math.max(0, delivery_cost - final.delivery_discount);
|
|
96
|
+
body.delivery_cost = delivery_cost;
|
|
97
|
+
}
|
|
96
98
|
|
|
97
99
|
// Adjust service amount based on service discount
|
|
98
100
|
if (final.is_service_discount) {
|
package/package.json
CHANGED