PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Helpers/AddressHelper.php +19 -0 1.5.2 → 1.6.5 View file →
@@ -9,8 +9,9 @@
9 9 use FluentCart\Api\StoreSettings;
10 10 use FluentCart\App\App;
11 11 use FluentCart\App\Models\CustomerAddresses;
12 12 use FluentCart\App\Models\Order;
13 +use FluentCart\App\Models\OrderAddress;
13 14 use FluentCart\App\Models\ShippingMethod;
14 15 use FluentCart\App\Services\Localization\LocalizationManager;
15 16 use FluentCart\App\Services\Renderer\CheckoutFieldsSchema;
16 17 use FluentCart\Framework\Support\Arr;
@@ -90,8 +91,26 @@
90 91 OrderAddressResource::create($addressFieldsData);
91 92 }
92 93 }
93 94 }
95 + }
96 +
97 + /**
98 + * Copy an existing OrderAddress's meta (company/VAT/legal-reg id/label) onto the
99 + * order-address row of the same type already created for $orderId. insertOrderAddresses()
100 + * only accepts flat column data, so a parent-order snapshot copy (renewals) must
101 + * carry meta over separately.
102 + */
103 + public static function copyOrderAddressMeta($orderId, $type, $sourceAddress): void
104 + {
105 + if (!$sourceAddress || empty($sourceAddress->meta)) {
106 + return;
107 + }
108 +
109 + OrderAddress::query()
110 + ->where('order_id', $orderId)
111 + ->where('type', $type)
112 + ->update(['meta' => json_encode($sourceAddress->meta)]);
94 113 }
95 114
96 115 public static function getIpAddress($anonymize = false)
97 116 {