You are here

public function ProductVariation::setActive in Commerce Core 8.2

Sets whether the variation is active.

Parameters

bool $active: Whether the variation is active.

Return value

$this

Overrides ProductVariationInterface::setActive

Deprecated

in Commerce 8.x-2.11. Use $this->setPublished() or $this->setUnpublished() instead.

File

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

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function setActive($active) {
  $this
    ->set('status', (bool) $active);
  return $this;
}