https://discord.umbraco.com logo
#help-with-umbraco
Umbraco Commerce. How do you handle discounts in the ui?
# help-with-umbraco
u

.sanderl

02/09/2024, 7:32 AM
Hi all, Umbraco Commerce has a great discount rule engine. The only downside is that it is applied to Orders only. How do you manage displaying discounts on the frontend? A lot of shops don't just want to show the discount whenever they are in the checkout, but also on product details/ product overviews. I know there is no built in feature for this (we asked support) so that's why I was wondering how other people handle this. Thanks
r

ravimotha

02/09/2024, 9:39 AM
I'm not an Umbraco Commerce guru or anything but when you get the Model for a product you can decorate it with any discounts that are available according to any rules... or create a variant with a discounted price?? Maybe @mattbrailsford could get one of the excellent team at Umbraco to answer this better than I can
u

.sanderl

02/09/2024, 9:59 AM
We are experimenting with different options. Maybe the next stop is to try and work with commerce entity picker and select a discount and see what we get
m

mattbrailsford

02/09/2024, 10:22 AM
The discount rules are a double edged sword realy. They are super flexible, but it means that they a super contextual. When you have rules that an order must meet certain criteria, it then becomes impossible to know if/when a discount would apply outside of an order context. Should you say there is a 20% on item X, even if you only meet the criteria if you are Member Y, and you have a subtotal greater than £50? This is why we can't know for sure if a discount applies, and by how much. The general options are: 1) Record a "originalPrice" on a product, and just always show that with a strike through on the front end. This means there is a bit of duplication though as you'll need to record the pre discoutned price, and then also setup the discount. 2) I've seen some people create a temporary order, adding the given product to it, and then seeing what discounts apply. Extracting those and then showing them on the product details page. This could get pretty intensive though. 3) I have also seen people query the discounts and just look for ones you know are global discounts, ie, they have no rules, but apply a percentage discount. You could extract those and then dynamically calculate what that discount would be on the price.
r

ravimotha

02/09/2024, 10:23 AM
Cheers @mbr_umbraco
u

.sanderl

02/10/2024, 11:32 AM
thanks for your thoughts and feedback @mbr_umbraco and @ravimotha
l

lesley.w

02/15/2024, 2:26 AM
@.sanderl We had a similar issue - client wanted to be able to show both original price and sale price on website. We ended up creating a specific discount for all sale items and check for that discount by alias to determine if item is on sale. It's a bit cumbersome, but works. In the Rules section we do an "Any" match and add an Order Line Product Rule for each item that is on sale. In the Rewards section we add an Order Line (with Product) Amount Reward for each item that is on sale and set price type to Unit Price and then use an Amount adjustment with the amount to take off for each unit of that specific product
u

.sanderl

02/15/2024, 6:43 AM
Thanks, always great to see how other people handle these kind of situations
4 Views