StockServiceConfig.php in Commerce Stock 8
File
src/StockServiceConfig.php
View source
<?php
namespace Drupal\commerce_stock;
use Drupal\commerce\PurchasableEntityInterface;
use Drupal\commerce\Context;
class StockServiceConfig implements StockServiceConfigInterface {
protected $stockLocations = [];
public function getAvailabilityLocations(Context $context, PurchasableEntityInterface $entity) {
return $this->stockLocations;
}
public function getTransactionLocation(Context $context, PurchasableEntityInterface $entity, $quantity) {
$locations = $this
->getAvailabilityLocations($context, $entity);
return array_shift($locations);
}
}
Classes
Name |
Description |
StockServiceConfig |
The default stock service configuration class. This class does nothing
meaningful and act as a stub to fullfil the StockServiceInterface for the
AlwaysInStockService. |