Observer/Customer/RegisterWishlist.php
private function registerWishlist($wishlist, $itemCount, $customer)
    {
        try {
            $emailWishlist = $this->wishlistFactory->create();

            //if wishlist exist not to save again
            if (! $emailWishlist->getWishlist($wishlist->getWishlistId())) {
                $storeName = $this->storeManager->getStore($customer->getStoreId())->getName();
                $emailWishlist->setWishlistId($wishlist->getWishlistId())
                    ->setCustomerId($wishlist->getCustomerId())
                    ->setStoreId($customer->getStoreId())
                    ->setItemCount($itemCount);

                $this->emailWishlistResource->save($emailWishlist);
                $this->registerWithAutomation($wishlist, $customer, $storeName);
            }
        } catch (\Exception $e) {
            $this->helper->error((string)$e, []);
        }
    }
private function registerWishlist($wishlist, $itemCount, $customer)
    {
        try {
            $emailWishlist = $this->wishlistFactory->create();

            //if wishlist exist not to save again
            if (! $emailWishlist->getWishlist($wishlist->getWishlistId())) {
                $storeName = $this->storeManager->getStore($customer->getStoreId())->getName();
                $emailWishlist->setWishlistId($wishlist->getWishlistId())
                    ->setCustomerId($wishlist->getCustomerId())
                    ->setStoreId($customer->getStoreId())
                    ->setItemCount($itemCount);

                $this->emailWishlistResource->save($emailWishlist);
                $this->registerWithAutomation($wishlist, $customer, $storeName);
            }
        } catch (\Exception $e) {
            $this->helper->error((string)$e, []);
        }
    }
private function registerWishlist ( $ wishlist , $ itemCount , $ customer ) { try { $ emailWishlist = $ this -> wishlistFactory -> create ( ) ; //if wishlist exist not to save again if ( ! $ emailWishlist -> getWishlist ( $ wishlist -> getWishlistId ( ) ) ) { $ storeName = $ this -> storeManager -> getStore ( $ customer -> getStoreId ( ) ) -> getName ( ) ; $ emailWishlist -> setWishlistId ( $ wishlist -> getWishlistId ( ) ) -> setCustomerId ( $ wishlist -> getCustomerId ( ) ) -> setStoreId ( $ customer -> getStoreId ( ) ) -> setItemCount ( $ itemCount ) ; $ this -> emailWishlistResource -> save ( $ emailWishlist ) ; $ this -> registerWithAutomation ( $ wishlist , $ customer , $ storeName ) ; } } catch ( \ Exception $ e ) { $ this -> helper -> error ( ( string ) $ e , [ ] ) ; } }
Register new wishlist.

@param \Dotdigitalgroup\Email\Model\Wishlist $wishlist
@param int $itemCount
@param \Magento\Customer\Api\Data\CustomerInterface $customer
Register new wishlist .