diff --git a/tests/Feature/ProductTest.php b/tests/Feature/ProductTest.php index 2bdd330f198e..40af31f9a9cc 100644 --- a/tests/Feature/ProductTest.php +++ b/tests/Feature/ProductTest.php @@ -100,7 +100,7 @@ class ProductTest extends TestCase foreach ($line_items as $key => $item) { - if($item?->product_cost == 0 && $product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first()) { + if(property_exists($item, 'product_cost') && $item->product_cost == 0 && $product = Product::where('company_id', $invoice->company_id)->where('product_key', $item->product_key)->where('cost', '>', 0)->first()) { $line_items[$key]->product_cost = $product->cost; } }