Caching of dynamic pages
We are developing a Shopware shop for a new customer. One of the features is dynamic pricing (customer-based prices) where customers are shown personalized prices that are loaded from an api. We had this working, deployed it to a test environment and noticed it didn't work because the cache is enabled on category and product detail pages when the production mode is enabled.
We load the prices using a subscriber that is based on '\Shopware\Core\Content\Product\Subscriber\ProductSubscriber'. But because of the caching in classes like '\Shopware\Core\Content\Category\SalesChannel\CachedCategoryRoute' the 'SalesChannelEntityLoadedEvent' is never fired and the original Shopware prices are cached as part of the page content.
When a customer is logged in you generally want to display personalized content, whether it's pricing, notifications, product suggestions, a personalized banner or special prices. That's why pages like that are usually not cached in systems like Magento, for example, when a customer is logged in.
Can you tell us if there's any other way to accomplish personalized/dynamic prices? We liked this approach because it ensures the right prices are always loaded on the products, whether it's on a shop page or when a customer adds a product to his/her cart.
Not enough interest
We’re closing this idea because it has not received significant interest or activity over the past 12 months. This helps us keep the idea portal focused on the topics that are most relevant to our community.
Thank you for taking the time to submit and support it. We’ll continue to monitor customer needs and may reconsider the topic if interest grows in the future.