You are here

public function LocalStockServiceConfig::getTransactionLocation in Commerce Stock 8

Get the location for automatic stock allocation.

This is normally a designated location to act as the main warehouse. This can also be a location worked out in realtime using the provided context (order & customer), entity and the quantity requested.

Parameters

\Drupal\commerce\Context $context: The context containing the customer & store.

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

int $quantity: The quantity.

Return value

\Drupal\commerce_stock\StockLocationInterface The stock location.

Overrides StockServiceConfigInterface::getTransactionLocation

File

modules/local_storage/src/LocalStockServiceConfig.php, line 43

Class

LocalStockServiceConfig
The local stock service configuration class.

Namespace

Drupal\commerce_stock_local

Code

public function getTransactionLocation(Context $context, PurchasableEntityInterface $entity, $quantity) {
  return $this->storage
    ->getTransactionLocation($context, $entity);
}