refactor(checkout): keep source cart active
This commit is contained in:
@@ -86,7 +86,9 @@ class UserPurchaseLimitService
|
||||
$excludedCartId !== null,
|
||||
fn ($query) => $query->whereKeyNot($excludedCartId),
|
||||
))
|
||||
->whereHas('stockReservations', fn ($query) => $query->where('status', 'active'))
|
||||
->whereHas('stockReservations', fn ($query) => $query
|
||||
->where('status', 'active')
|
||||
->whereNull('purchase_id'))
|
||||
->sum('cantidad');
|
||||
|
||||
if ($purchasedQuantity + $checkoutQuantity + $reservedCartQuantity + $requestedQuantity > $limit) {
|
||||
@@ -152,7 +154,9 @@ class UserPurchaseLimitService
|
||||
->whereHas('cart', fn ($query) => $query
|
||||
->where('user_id', $userId)
|
||||
->where('status', 'active'))
|
||||
->whereHas('stockReservations', fn ($query) => $query->where('status', 'active'))
|
||||
->whereHas('stockReservations', fn ($query) => $query
|
||||
->where('status', 'active')
|
||||
->whereNull('purchase_id'))
|
||||
->groupBy('catalog_item_id')
|
||||
->pluck('quantity', 'catalog_item_id');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user