public function WishlistManager::removeWishlistItem in Commerce Wishlist 8.3
Removes the given wishlist item from the wishlist entity.
Parameters
\Drupal\commerce_wishlist\Entity\WishlistInterface $wishlist: The wishlist entity.
\Drupal\commerce_wishlist\Entity\WishlistItemInterface $wishlist_item: The wishlist item.
bool $save_wishlist: Whether the wishlist should be saved after the operation.
Overrides WishlistManagerInterface::removeWishlistItem
File
- src/
WishlistManager.php, line 121
Class
- WishlistManager
- Default implementation of the wishlist manager.
Namespace
Drupal\commerce_wishlistCode
public function removeWishlistItem(WishlistInterface $wishlist, WishlistItemInterface $wishlist_item, $save_wishlist = TRUE) {
$wishlist
->removeItem($wishlist_item);
if ($save_wishlist) {
$wishlist
->save();
}
$wishlist_item
->delete();
}