You are here

public function LocalStockChecker::getIsInStock in Commerce Stock 8

Check if purchasable entity is in stock.

Parameters

\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.

\Drupal\commerce_stock\StockLocationInterface[] $locations: The locations to check against.

Return value

bool TRUE if the entity is in stock, FALSE otherwise.

Overrides StockCheckInterface::getIsInStock

File

modules/local_storage/src/LocalStockChecker.php, line 191

Class

LocalStockChecker
The stock checker implementation for the local stock module.

Namespace

Drupal\commerce_stock_local

Code

public function getIsInStock(PurchasableEntityInterface $entity, array $locations) {
  return $this
    ->getTotalStockLevel($entity, $locations) > 0;
}