I need to implement a discount when there are 3 items in the cart, the 3rd item is 50% off. How can I go about implementing such a discount? Can anyone help?
So far Ive tried using the updateCart function on the frontend when addItem function is triggered, but the data passed in for updateCart, takes in a data type of class StorePostCartsCartReq which does not include total or subtotal. Even the Cart table in the postgresql database doesn't have a total or subtotal field in any of the tables. I think the price is calculated by using the line_item table which has both unit_price and quantity. This is probably why Im facing such difficulty in trying to apply discount on a specific item in the cart, as Medusa only allows discount to be applied on all items in the cart. Which has been confirmed by @dim gale when I asked it.
https://discord.com/channels/876835651130097704/1225937626675150959
But I think the discount on the 3rd item in the cart can be implemented if I use a custom-service. But can anyone help me figure out how I might go about doing that?