Skip to content

Pricing not consistently reflected due to product cache#44

Merged
sstakhovski merged 5 commits intomasterfrom
fix/account-group-price
Mar 10, 2026
Merged

Pricing not consistently reflected due to product cache#44
sstakhovski merged 5 commits intomasterfrom
fix/account-group-price

Conversation

@sstakhovski
Copy link
Contributor

@sstakhovski sstakhovski commented Mar 10, 2026

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.

@sstakhovski sstakhovski self-assigned this Mar 10, 2026
@sstakhovski sstakhovski merged commit 2ba1329 into master Mar 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants