saleor
saleor copied to clipboard
Add sales object to products
What I'm trying to achieve
Fetch sale details for products
Use case
• Displaying sale details and terms on the PDP • Programmatically removing from all sales
Describe a proposed solution
query SaleInProducts {
products(first: 10, channel: "default-channel") {
edges {
node {
name
sales {
name
type
startDate
endDate
}
}
}
}
}
for the product connection it would also be nice to have the ability to do sorting on sale by amount of discount in percentage or price.
@timuric how about this? Currently, we fetch all sales to display pricing.
When we add it to PricingInfo
we receive sales
field in Product
, ProductVariant
, and ProductChannelListing
.
query SaleInProducts {
products(first: 10, channel: "default-channel") {
edges {
node {
name
pricing {
onSale
sales {
name
type
startDate
endDate
}
}
}
}
}
}
Personally, I would say, that sale
should not be a part of pricing. The effect of applying discount from sale
is something that belongs to pricing
(like price
on VariantPricingInfo
that already include the discount from Sale) but not a whole object.