← All changes
|
api/Resource/FrontendResource/CustomerAddressResource.php
+10
-2
1.3.20
→
1.6.5
View file →
| @@ -113,9 +113,9 @@ | ||
| 113 | 113 | } |
| 114 | 114 | $data['customer_id'] = $id; |
| 115 | 115 | |
| 116 | 116 | // set others data as meta |
| 117 | - $otherData = Arr::only($data, ['company_name', 'first_name', 'last_name', 'phone']); | |
| 117 | + $otherData = Arr::only($data, ['company_name', 'vat_number', 'legal_registration_id', 'first_name', 'last_name', 'phone']); | |
| 118 | 118 | Arr::set($data, 'meta.other_data', $otherData); |
| 119 | 119 | |
| 120 | 120 | $isCreated = static::getQuery()->create($data); |
| 121 | 121 | |
| @@ -169,8 +169,16 @@ | ||
| 169 | 169 | ['code' => 404, 'message' => __('Address not found, please reload the page and try again!', 'fluent-cart')] |
| 170 | 170 | ]); |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | + $otherData = Arr::only($data, ['company_name', 'vat_number', 'legal_registration_id', 'first_name', 'last_name', 'phone']); | |
| 174 | + $existingMeta = is_array($address->meta) ? $address->meta : []; | |
| 175 | + Arr::set($existingMeta, 'other_data', array_merge( | |
| 176 | + Arr::get($existingMeta, 'other_data', []), | |
| 177 | + $otherData | |
| 178 | + )); | |
| 179 | + $data['meta'] = $existingMeta; | |
| 180 | + | |
| 173 | 181 | $isUpdated = $address->update($data); |
| 174 | 182 | |
| 175 | 183 | if ($isUpdated) { |
| 176 | 184 | static::makeSuccessResponse($isUpdated, __('Customer address updated successfully!', 'fluent-cart')); |
| @@ -243,5 +251,5 @@ | ||
| 243 | 251 | return static::makeErrorResponse([ |
| 244 | 252 | ['code' => 400, 'message' => __('Address set as primary failed.', 'fluent-cart')] |
| 245 | 253 | ]); |
| 246 | 254 | } |
| 247 | -} | |
| 255 | +} | |