I am trying to edit the product collection in category page.
Every time I try to load and edit the collection
vendor/magento/module-catalog/Block/Product/ListProduct::getLoadedProductCollection()
or its parent methods and models like
vendor/magento/module-catalog/Model/Layer::getProductCollection()
vendor/magento/module-catalog/Model/Layer::prepareProductCollection($collection)
it is unsuccessful and “All the products” in that category get loaded in category page.
I tried to use after and around plugins for those collection to edit them, but it didn’t help.
I read this issue on Git https://github.com/magento/magento2/issues/32268#issuecomment-1028162868 and it is exactly my issue. The writer mentioned that he removed some affiliate links from category list template and that fixed the issue.
I couldn’t find any specific third party link on my template except Klaviyo which is running in header and on all pages.
I am using M2.4.5
Can somebody help me with this issue? What is the correct way to retrieve that collection and edit it?