function commerce_wishlist_commerce_wishlist_delete in Commerce Wishlist 8.3
Implements hook_ENTITY_TYPE_delete().
Removes deleted wishlists from the anonymous user's session.
File
- ./
commerce_wishlist.module, line 45 - Defines the Wishlist entity and associated features.
Code
function commerce_wishlist_commerce_wishlist_delete(WishlistInterface $wishlist) {
/** @var \Drupal\commerce_wishlist\WishlistSessionInterface $wishlist_session */
$wishlist_session = \Drupal::service('commerce_wishlist.wishlist_session');
$wishlist_session
->deleteWishlistId($wishlist
->id());
}