Let's say we want to display a discounted price fo...
# support
k
Let's say we want to display a discounted price for a product. This product is not in the user's cart. Spree::Promotions seem to run ont he user's cart so what is the mechanism we use in Solidus for generic product based discounting..
j
Depends on your specific use case. There's an extension called solidus_sale_prices that can be useful for this, as promotions aren't a good fit (due to one promotion per order)
k
@Jared Norman thanks.. seems like it hasn't been updated much, do you know if it works with 3.0?
I see in the github issues that maybe it doesn't
j
Yeah, the work to make it work isn't complete.
k
Ok, as a workaround I guess what I can do is is just look to see if it has a ProductPromotionRule and if it does.. apply the flat rate associated with that promotion to the product when returning pricing.. any issues with that?
j
That's still going to run into the issue of one promo per order, right?
k
oh hmm
e
I think we have some code around to do it
https://gist.github.com/softr8/cc7d85dd6317bba1809f79c17a670520 <= it hasn't been tested on production, it just passed unit tests 😛
k
@Edwin Cruz while yes I see that would get the list of product promotions. I may be wrong about this but it seems the problem is that that the promotion system only allows one applied promotion per order so if you set say.. a product promotion on 10 different products and a user adds all of them to their order, it will only apply the largest discount to your order? I think there would need to be some sort of separate bit of code that uses a PriceSelector for Variant so that the variant both shows the new price on the frontend but it's also applied as the price to line items.. ?
e
yeah, it gets tricky, we saw some of those corner cases as well, and we tried to solve with some UX, like: this product might be elegible for X promotion, I guess that's why it's not in production yet, so many things to iron
k
I don't know that I would call these corner cases as much as standard use cases but yes it's something that needs to be considered.