Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected $customerSession;
- protected $wishlist;
- public function __construct(
- ...
- MagentoCustomerModelSession $customerSession,
- MagentoWishlistModelWishlist $wishlist,
- ...
- ) {
- ...
- $this->customerSession = $customerSession;
- $this->wishlist = $wishlist;
- ...
- }
- public function yourFunction(){
- $customer_id = $this->customerSession->getCustomer()->getId();
- $wishlist_collection = $this->wishlist->loadByCustomerId($customer_id, true)->getItemCollection();
- $product_ids = [];
- foreach ($wishlist_collection as $item) {
- $product_ids[] = $item->getProduct()->getId();
- }
- return $product_ids;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement