I've been struggling with Magento\Catalog\Block\Product\ListProduct::initializeProductCollection()
from a few days.
I need to filter category product collection based on user's location. So forexample I've to show 2 types of listings: one for location-based(when user's location is set) and other for non-location based (when user's location is not set). The location based listing is basically a filtered set of the product collection. Simply, I don't want to show certain type of product to customer if his location is set.
I've written my custom code to filter product collection but the problem happens when I change the location, it still shows me old collection. I know the full page caching is making issues. I tried making the lifetime of cache ListProduct block as null but still I'm able to see the old collection until I clear the cache.
Question:
Is there a way I can define custom caching process for caching the category page?