You are here

public function WishlistManagerInterface::addEntity in Commerce Wishlist 8.3

Adds the given purchasable entity to the given wishlist entity.

Parameters

\Drupal\commerce_wishlist\Entity\WishlistInterface $wishlist: The wishlist entity.

\Drupal\commerce\PurchasableEntityInterface $entity: The purchasable entity.

int $quantity: The quantity.

bool $combine: Whether the wishlist item should be combined with an existing matching one.

bool $save_wishlist: Whether the wishlist should be saved after the operation.

Return value

\Drupal\commerce_wishlist\Entity\WishlistItemInterface The saved wishlist item.

1 method overrides WishlistManagerInterface::addEntity()
WishlistManager::addEntity in src/WishlistManager.php
Adds the given purchasable entity to the given wishlist entity.

File

src/WishlistManagerInterface.php, line 42

Class

WishlistManagerInterface
Manages the wishlist and its wishlist items.

Namespace

Drupal\commerce_wishlist

Code

public function addEntity(WishlistInterface $wishlist, PurchasableEntityInterface $entity, $quantity = 1, $combine = TRUE, $save_wishlist = TRUE);