WishlistMergedEvent example

$wishlistId = $this->getWishlistId($context$customer->getId());

        $upsertData = $this->buildUpsertProducts($data$wishlistId$context);

        $this->wishlistRepository->upsert([[
            'id' => $wishlistId,
            'customerId' => $customer->getId(),
            'salesChannelId' => $context->getSalesChannel()->getId(),
            'products' => $upsertData,
        ]]$context->getContext());

        $this->eventDispatcher->dispatch(new WishlistMergedEvent($upsertData$context));

        return new SuccessResponse();
    }

    private function getWishlistId(SalesChannelContext $context, string $customerId): string
    {
        $criteria = new Criteria();
        $criteria->setLimit(1);
        $criteria->addFilter(new MultiFilter(MultiFilter::CONNECTION_AND, [
            new EqualsFilter('customerId', $customerId),
            new EqualsFilter('salesChannelId', $context->getSalesChannel()->getId()),
        ]));
Home | Imprint | This part of the site doesn't use cookies.