You are here

public function ProductVariation::getProduct in Commerce Core 8.2

Gets the parent product.

Return value

ProductInterface|null The product entity, or null.

Overrides ProductVariationInterface::getProduct

3 calls to ProductVariation::getProduct()
ProductVariation::getStores in modules/product/src/Entity/ProductVariation.php
Gets the stores through which the purchasable entity is sold.
ProductVariation::postSave in modules/product/src/Entity/ProductVariation.php
Acts on a saved entity before the insert or update hook is invoked.
ProductVariation::toUrl in modules/product/src/Entity/ProductVariation.php
Gets the URL object for the entity.

File

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

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function getProduct() {
  return $this
    ->getTranslatedReferencedEntity('product_id');
}