0

How we can get the latest wishlist collection for a particular login customer without cache clean in Magento2?

2
  • use cachable="false" in layout file – Pramod Dec 31 '20 at 11:31
  • 1
    Do not use cachable="false" that stops the cache working for any effected page. Where are you trying to get the information and how are you trying to get it? (Pages types, phtml file, ajax request etc.) – Mark Rees Dec 31 '20 at 12:19
1

Try this

protected $itemsCollection;

public function __construct(
    ............................................................
    \Magento\Wishlist\Model\ResourceModel\Item\CollectionFactory $itemsCollection,
    ............................................................
) {
    $this->itemsCollection = $itemsCollection;
}

public function getAllWishlistItems()
{
    return $this->itemsCollection->create();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.