You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In promotions sales, there is an option to specify which user group that entitled for the sales. So here is my question is how to get that sale price for the user in GraphQL.
I have tried to do query for the products in graphQL like this :
product(slug: $slug) {
id
title
slug
uri
defaultPrice
variants {
price
sales {
name
}
salePrice
}
}
and we also pass the session data when requested it.
So here is our scenario :
query the products with sales
Login to user account that entitled with the sales
do query for the products with sales.
Our expected is in step 3 the sale price is updated, but it turns out still same with price like in step 1 also the sales field is empty.
After some search, found out the issue is in gql cache, so if there is a user that not eligible for the sales query first the gql will get cache, so then if there is second person querying through gql and this person eligible with sales, the returned data from gql is the cache one from user that not eligible from sales.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In promotions sales, there is an option to specify which user group that entitled for the sales. So here is my question is how to get that sale price for the user in GraphQL.
I have tried to do query for the products in graphQL like this :
and we also pass the session data when requested it.
So here is our scenario :
Our expected is in step 3 the sale price is updated, but it turns out still same with price like in step 1 also the sales field is empty.
After some search, found out the issue is in gql cache, so if there is a user that not eligible for the sales query first the gql will get cache, so then if there is second person querying through gql and this person eligible with sales, the returned data from gql is the cache one from user that not eligible from sales.
Beta Was this translation helpful? Give feedback.
All reactions