Calculated prices per item and not order
See original GitHub issueIs your feature request related to a problem? Please describe. The prices won’t be displayed to the customers before they add it to the cart.
Describe the solution you’d like
I will like to show them if a certain product is on sale, or if eg. a product is cheaper if the customer would bulk buy. Like eg:
Item A is on sale for 20%. 1 for 20. Or buy 5 for 15/piece
This would lead to better sell.
Technically it would be nice to have salesPrice
in the item. Maybe with configuration where you can customize the calculation of the price.
There will in my case be:
Discount for an item as % or fixed price.
Discount for a customer group as % or fixed price.
Discount for a customer within price group as fixed price.
Discount for a customer within discount group as %.
Calculation in short:
- Take the lowest possible fixed price.
- Take the lowest possible % discount.
- Add % discount to the fixed price.
Describe alternatives you’ve considered I’ve disabled the default price field on productVariant and added custom price which includes default price and salesPrice. In the salesPrice, it would pull ALL promotions, and then filter them, and then calculate. Imagine doing this for every products in a queried list of products. This slows down the query pretty much. It is also a problem for ordering, as the price is in a custom field.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
@HarunKilic ok so if I understand correctly, in this way you’ll be pre-calculating the bulk prices ahead of time. If so, that’s a smart way to do it - you can put that work on the worker process and just let it run. Then you’ll incur zero performance cost at query time.
@dominikager this strategy sounds fine for the product detail page, assuming you do not have hundreds of variants being calculated at once.
@HarunKilic we also need the discount on the Item and not on the Order. We are thinking about implementing a “getSalePrice” Query. This will have the country, customer, and product as arguments. Based on that we can directly show the correct price on the Product Detail page.