Fix access to orders in bo when a product doesn't exist
This commit is contained in:
parent
c8090420ca
commit
57b16ddb1f
1 changed files with 3 additions and 1 deletions
|
|
@ -42,7 +42,9 @@ class ToolboxHelper
|
|||
$cart = self::createVirtualCart(\collect($basket)
|
||||
->map(function (object $basketItem) {
|
||||
$cartItem = self::basketItemObjectToCartItem($basketItem);
|
||||
$cartItem->associate(Product::query()->where('id', $cartItem->id)->first());
|
||||
if (Product::query()->where('id', $cartItem->id)->exists()) {
|
||||
$cartItem->associate(Product::query()->where('id', $cartItem->id)->first());
|
||||
}
|
||||
return $cartItem;
|
||||
})
|
||||
// * Enlever les produits qui ne seront pas livrés.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue