@php $isAuthUser = !empty($userData['id']); // берем первый не null промокод из двух корзин (или пусто) $commonPromocode = $userLocalBasket['promocode'] ?? $userCenterBasket['promocode'] ?? ''; // если вдруг они разные — решай сам: я бы показывал local, а при apply писал в обе @endphp
@php $baskets = [ 'local' => [ 'title' => $cityStore ? 'Доставка из г. ' . $cityStore : '', 'ids' => $cartLocalIDS ?? [], 'cart' => $userLocalCart ?? [], 'priceCheck' => $totalLocalCartPriceCheck ?? 0, 'discountTotal' => $totalLocalCartDiscount ?? null, 'totalPrice' => $totalLocalCartPrice ?? 0, ], 'center' => [ 'title' => 'Доставка из г. Санкт-Петербург', 'ids' => $cartCenterIDS ?? [], 'localQuant' => $localQuantities ?? [], 'cart' => $userCenterCart ?? [], 'priceCheck' => $totalCenterCartPriceCheck ?? 0, 'discountTotal' => $totalCenterCartDiscount ?? null, 'totalPrice' => $totalCenterCartPrice ?? 0, ], ]; @endphp @foreach($baskets as $type => $b) @if(!empty($b['ids'])) {{-- Полоска --}}
{{-- TITLE --}}

{{ $b['title'] }}

{{-- MIN SUM INFO --}} @if(($b['priceCheck'] ?? 0) < 1)

Сумма минимального заказа 1 рубль.

@endif {{-- ITEMS --}}
@foreach ($b['cart'] as $item)

@if(!empty($item['cart_discount']) && $item['cart_discount'] > 0) {{ $item['cart_subtotal_before_format'] }} @endif {{ $item['cart_subtotal_format'] }}

{{ $item['name'] }}
@if($type === 'center')
@elseif($type === 'local' && !in_array($item['id'], $baskets['center']['ids']))
@endif
@endforeach
{{-- CHECKOUT UNDER THIS BASKET --}}
@if(!is_null($b['discountTotal']))

Скидка: {{ $b['discountTotal'] }}


@endif

Итого: {{ $b['totalPrice'] ?? '' }}

@endif @endforeach