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 | api/Resource/CustomerAddressResource.php +5 -5 1.6.0 → 1.6.5 View file →
@@ -313,9 +313,9 @@
313 313 // Check if a valid ID is provided
314 314 if (!$id) {
315 315 return static::makeErrorResponse([
316 316 ['code' => 403, 'message' => __('Please use a valid address ID!', 'fluent-cart')]
317 - ]);
317 + ], 403);
318 318 }
319 319
320 320 // Retrieve the customer address using the ID
321 321 $customerAddress = static::getQuery()->find($id);
@@ -324,9 +324,9 @@
324 324 // Check if the address is marked as primary
325 325 if ($customerAddress->is_primary) {
326 326 return static::makeErrorResponse([
327 327 ['code' => 403, 'message' => __('Primary address cannot be deleted!', 'fluent-cart')]
328 - ]);
328 + ], 403);
329 329 }
330 330 // Get the count of addresses for this customer
331 331 $addressCount = static::getQuery()->where('customer_id', $customerAddress->customer_id)->count();
332 332
@@ -333,9 +333,9 @@
333 333 // Check if there's only one address, do not allow deletion in that case
334 334 if ($addressCount <= 1) {
335 335 return static::makeErrorResponse([
336 336 ['code' => 403, 'message' => __('At least one address must remain. Address deletion failed!', 'fluent-cart')]
337 - ]);
337 + ], 403);
338 338 }
339 339
340 340 // If the address is not primary and there are multiple addresses, proceed with deletion
341 341 if ($customerAddress->delete()) {
@@ -344,14 +344,14 @@
344 344
345 345 // Return an error if the address is not found in the database
346 346 return static::makeErrorResponse([
347 347 ['code' => 400, 'message' => __('Address deletion failed!', 'fluent-cart')]
348 - ]);
348 + ], 400);
349 349 }
350 350
351 351 return static::makeErrorResponse([
352 352 ['code' => 404, 'message' => __('Address not found in database, failed to remove.', 'fluent-cart')]
353 - ]);
353 + ], 404);
354 354 }
355 355
356 356 /**
357 357 * Make primary address for the specified customer.