Pricing not consistently reflected due to product cache#44
Merged
sstakhovski merged 5 commits intomasterfrom Mar 10, 2026
Merged
Pricing not consistently reflected due to product cache#44sstakhovski merged 5 commits intomasterfrom
sstakhovski merged 5 commits intomasterfrom
Conversation
awwit
reviewed
Mar 10, 2026
awwit
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://app.asana.com/1/1126683767705082/project/1204122196581246/task/1213439244550830?focus=true
We use caching based on the current version of the storefront. Therefore, regardless of whether the user is logged in or not, the previously cached version of the product is loaded. However, the product price may depend on the current account (price can depend on account group). If we use the cached version, the product price will not change after logging in to an account with a different account group.
I added the current account_id to the cache keys. This way, if an account changes, its own cached version will be used. I don't clear the cache because it can be shared, as noted in the comments. I prefer the account_id from the storefrontContext instead of the swell-session cookie because we encode a lot of different data in the swell-session.
Note: this approach will increase the cache size.