You are here

public function ProductVariation::getStores in Commerce Core 8.2

Gets the stores through which the purchasable entity is sold.

Return value

\Drupal\commerce_store\Entity\StoreInterface[] The stores.

Overrides PurchasableEntityInterface::getStores

File

modules/product/src/Entity/ProductVariation.php, line 252

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function getStores() {
  $product = $this
    ->getProduct();
  return $product ? $product
    ->getStores() : [];
}