#[Route(path: '/store-api/customer/wishlist/delete/{productId}', name: 'store-api.customer.wishlist.delete', methods: ['DELETE'], defaults: ['_loginRequired' => true])]
public function delete(string
$productId, SalesChannelContext
$context, CustomerEntity
$customer): SuccessResponse
{ if (!
$this->systemConfigService->
get('core.cart.wishlistEnabled',
$context->
getSalesChannel()->
getId())) { throw CustomerException::
customerWishlistNotActivated();
} $wishlistId =
$this->
getWishlistId($context,
$customer->
getId());
$wishlistProductId =
$this->
getWishlistProductId($wishlistId,
$productId,
$context);
$this->productRepository->
delete([ [ 'id' =>
$wishlistProductId,
],
],
$context->
getContext());
$this->eventDispatcher->
dispatch(new WishlistProductRemovedEvent($wishlistId,
$productId,
$context));
return new SuccessResponse();
}