| @@ -275,13 +275,35 @@ | ||
| 275 | 275 | 'note' => Arr::get($this->args, 'note', ''), |
| 276 | 276 | 'ip_address' => Arr::get($this->args, 'ip_address', ''), |
| 277 | 277 | 'config' => [ |
| 278 | 278 | 'user_tz' => Arr::get($this->args, 'user_tz', ''), |
| 279 | + 'source' => 'admin', | |
| 279 | 280 | ], |
| 280 | 281 | ]; |
| 281 | 282 | |
| 282 | 283 | $totalAmount = $orderData['subtotal'] - $orderData['coupon_discount_total'] - $orderData['manual_discount_total'] + $orderData['shipping_total'] + $orderData['tax_total']; |
| 283 | 284 | $orderData['total_amount'] = $totalAmount > 0 ? $totalAmount : 0; |
| 285 | + | |
| 286 | + /** | |
| 287 | + * Filter the prepared order data before it is used for order creation. | |
| 288 | + * | |
| 289 | + * This mirrors the frontend checkout hook so integrations can adjust | |
| 290 | + * order payload fields consistently for manual admin orders too. | |
| 291 | + * | |
| 292 | + * @param array $orderData Prepared order data array. | |
| 293 | + * @param array $context { | |
| 294 | + * Additional context for the filter. | |
| 295 | + * | |
| 296 | + * @type array $items Formatted order items with prices and quantities. | |
| 297 | + * @type array $args Admin order arguments: customer data, payment | |
| 298 | + * method, shipping, tax, notes, and IP data. | |
| 299 | + * } | |
| 300 | + */ | |
| 301 | + $orderData = apply_filters('fluent_cart/checkout/order_data', $orderData, [ | |
| 302 | + 'items' => $this->formattedIOrderItems, | |
| 303 | + 'args' => $this->args, | |
| 304 | + ]); | |
| 305 | + | |
| 284 | 306 | $this->orderData = $orderData; |
| 285 | 307 | } |
| 286 | 308 | |
| 287 | 309 | |
| @@ -562,8 +584,9 @@ | ||
| 562 | 584 | 'bill_count' => 0, |
| 563 | 585 | 'quantity' => 1, |
| 564 | 586 | 'variation_id' => Arr::get($item, 'object_id', 0), |
| 565 | 587 | 'status' => Status::SUBSCRIPTION_PENDING, |
| 588 | + 'collection_method' => Status::SUBSCRIPTION_METHOD_MANUAL, | |
| 566 | 589 | 'config' => [ |
| 567 | 590 | 'currency' => $this->orderData['currency'], |
| 568 | 591 | 'is_trial_days_simulated' => Arr::get($subscriptionPricing, 'is_trial_days_simulated', 'no'), |
| 569 | 592 | // Snapshot the variant attribute map + variation type from the order |