← All changes
|
app/Hooks/Handlers/CustomCheckout/CustomCheckout.php
+12
-5
1.6.3
→
1.6.5
View file →
| @@ -146,9 +146,13 @@ | ||
| 146 | 146 | '__cart_notices' => [ |
| 147 | 147 | [ |
| 148 | 148 | 'id' => 'custom_payment_notice', |
| 149 | 149 | 'type' => 'info', |
| 150 | - 'content' => 'You are making payment for your order (#' . $order->uuid . ').', | |
| 150 | + 'content' => sprintf( | |
| 151 | + /* translators: %1$s: the order UUID. */ | |
| 152 | + __('You are making payment for your order (#%1$s).', 'fluent-cart'), | |
| 153 | + $order->uuid | |
| 154 | + ), | |
| 151 | 155 | ] |
| 152 | 156 | ] |
| 153 | 157 | ]; |
| 154 | 158 | |
| @@ -229,13 +233,16 @@ | ||
| 229 | 233 | Arr::set($item, 'other_info', $otherInfo); |
| 230 | 234 | } |
| 231 | 235 | |
| 232 | 236 | if ($itemManualDiscountTotal) { |
| 233 | - $subtotal = Arr::get($orderItem, 'subtotal'); | |
| 234 | - $manualDiscount = ($subtotal * $itemManualDiscountTotal) / $order->subtotal; | |
| 235 | - $couponDiscount = max(0, $orderItem->discount_total - $manualDiscount); | |
| 237 | + // Use the order item's own stored split rather than proportionally | |
| 238 | + // redistributing the order-level manual_discount_total — a manual | |
| 239 | + // discount concentrated on one item must stay on that item, or this | |
| 240 | + // reconstruction both keeps it there AND leaves a duplicate slice | |
| 241 | + // behind as "coupon_discount" on it. | |
| 242 | + $manualDiscount = max(0, (int) $orderItem->discount_total - (int) $orderItem->coupon_discount); | |
| 236 | 243 | Arr::set($item, 'manual_discount', $manualDiscount); |
| 237 | - Arr::set($item, 'coupon_discount', $couponDiscount); | |
| 244 | + Arr::set($item, 'coupon_discount', (int) $orderItem->coupon_discount); | |
| 238 | 245 | } |
| 239 | 246 | |
| 240 | 247 | $items[] = CartHelper::generateCartItemCustomItem($item, $orderItem->quantity); |
| 241 | 248 | } |