inventory_subject) { InventorySubject::Seat => __('api.purchase.stock.seat_unavailable', [ 'selection' => $selection->getSelectionLabel(), ]), InventorySubject::Ticket => __('api.purchase.stock.ticket_unavailable', [ 'selection' => $selection->getSelectionLabel(), ]), InventorySubject::Product => __('api.purchase.stock.product_unavailable', [ 'selection' => $this->productSelectionLabel($catalogItem, $selection), 'max' => $availableQuantity, ]), }; } private function productSelectionLabel( CatalogItem $catalogItem, CatalogItem|Variant $selection, ): string { if ($selection instanceof CatalogItem) { return $selection->getSelectionLabel(); } return __('api.purchase.stock.product_selection', [ 'product' => $catalogItem->getName(), 'selection' => $selection->getSelectionLabel(), ]); } }