You are here

public function ProductVariation::isActive in Commerce Core 8.2

Gets whether the variation is active.

Inactive variations are not visible on add to cart forms.

Return value

bool TRUE if the variation is active, FALSE otherwise.

Overrides ProductVariationInterface::isActive

Deprecated

in Commerce 8.x-2.11. Use $this->isPublished() instead.

File

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

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function isActive() {
  return (bool) $this
    ->getEntityKey('published');
}