-
Notifications
You must be signed in to change notification settings - Fork 674
Conversation
Deploy preview for saleor-storefront-stage processing. Building with commit 9c43ae0 https://app.netlify.com/sites/saleor-storefront-stage/deploys/5e1daf6f979a1300076425f6 |
src/@sdk/queries/products.ts
Outdated
@@ -55,7 +55,7 @@ export const productListDetails = gql` | |||
edges { | |||
node { | |||
...BasicProductFields | |||
price { | |||
basePrice { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field requires a staff permission - which means it's meant for the dashboard app. I know it's kind of messed up together - we need to have separate API for storefront and dashboard.
Public pricing should be taken from the pricing
field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The product's price is a range since we can override the price for one of its variants. To get this range we can use:
pricing {
priceRange {
start {
net {
amount
}
}
stop {
net {
amount
}
}
}
}
Example response:
"pricing": {
"priceRange": {
"start": {
"net": {
"amount": 1.8
}
},
"stop": {
"net": {
"amount": 4.2
}
}
}
}
In this case, in the product page, we should render the price as "From $1.8". If the amounts were equal then we could render the precise value. That's the logic we used to have in the old storefront in the good old Django-templates times ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it with rendering range e.g. "1,80 USD - 4,20 USD" if values are not equal, similarly as it is rendered when variants exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I used gross value... Does it matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to use gross prices for now. Eventually, it should depend on this setting:
{
shop {
displayGrossPrices
}
}
But it can be done in a separate PR (we have an issue for that)
A new stable release with this fix has note been drafted - following the README of saleor-storefront, running the 0.7.0 version throws the same 400 bad requests. Could you draft a new release? |
I want to merge this change because current storefront doesn't work with the latest API, what this PR should fix.
Screenshots
Pull Request Checklist