public function BundleItemInterface::setVariations in Commerce Product Bundle 8
Sets the variations.
If the bundle item doesn't hold a product reference yet, the product of the first variation will be set as the bundle items product.
Parameters
\Drupal\commerce_product\Entity\ProductVariationInterface[] $variations: The variations.
Return value
\Drupal\commerce_product_bundle\Entity\BundleItemInterface The called product bundle item entity.
Throws
\InvalidArgumentException In case the variations don't belong to the same product or if applicable to the already referenced product.
1 method overrides BundleItemInterface::setVariations()
- ProductBundleItem::setVariations in src/
Entity/ ProductBundleItem.php - Sets the variations.
File
- src/
Entity/ BundleItemInterface.php, line 202
Class
- BundleItemInterface
- Provides an interface for defining product bundle item entities.
Namespace
Drupal\commerce_product_bundle\EntityCode
public function setVariations(array $variations);