diff --git a/app/Repositories/Shop/Customers.php b/app/Repositories/Shop/Customers.php index 04be4e4f..22460b53 100644 --- a/app/Repositories/Shop/Customers.php +++ b/app/Repositories/Shop/Customers.php @@ -102,8 +102,8 @@ class Customers public static function storeFull($data) { $data2 = $data; - if ($data['sale_channels'] ?? false) { - $saleChannels = $data['sale_channels'] ?? false; + $saleChannels = array_key_exists('sale_channels', $data) ? $data['sale_channels'] : null; + if ($saleChannels !== null) { unset($data['sale_channels']); } if ($data['deliveries'] ?? false) { @@ -113,7 +113,9 @@ class Customers unset($data['invoices']); } $customer = self::store($data); - $customer->sale_channels()->sync($saleChannels); + if ($saleChannels !== null) { + $customer->sale_channels()->sync($saleChannels); + } CustomerAddresses::storeByCustomer($customer, $data2); return $customer->id;