saleor icon indicating copy to clipboard operation
saleor copied to clipboard

Add sales object to products

Open timuric opened this issue 2 years ago • 2 comments

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
        }
      }
    }
  }
}

timuric avatar Apr 05 '22 09:04 timuric

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.

afewyards avatar Apr 16 '22 20:04 afewyards

@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
          }
        }
      }
    }
  }
}

fowczarek avatar Sep 21 '22 08:09 fowczarek

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.

korycins avatar Sep 26 '22 12:09 korycins