You are here

public function ProductBundleItem::removeVariation in Commerce Product Bundle 8

Removes a variation.

Parameters

\Drupal\commerce_product\Entity\ProductVariationInterface $variation: The variation.

Return value

$this

Overrides BundleItemInterface::removeVariation

File

src/Entity/ProductBundleItem.php, line 373

Class

ProductBundleItem
Defines the product bundle item entity.

Namespace

Drupal\commerce_product_bundle\Entity

Code

public function removeVariation(ProductVariationInterface $variation) {
  $index = $this
    ->getVariationIndex($variation);
  if ($index !== FALSE) {
    $this
      ->get('variations')
      ->offsetUnset($index);
  }
  return $this;
}