spree/spree — pull request #4773 by magnusvk (2014-06-03 15:16:27+00:00)
Title: Prevent multiple promotions on the same order

The desired behavior when applying multiple promotions to one order is for Spree to choose the one that gives the largest discount, but disable all others. This makes sure that customers cannot combine multiple discounts.

However, before this change, this was only enforced for promotions of the same type. I.e. you could only use one line-item-level promo per order, and one order-level promo per order. But you *could* combine a line-item-level promo with an order-level promo and they would both be applied at the same time, combining the discounts.

With this change, we compare order-level adjustments with the sum of all line-item adjustments per promotion. Then, we pick the best promotion and disable all others.

cc/ @huoxito -- I think you are familiar with this code.
cc/ @gmacdougall, @cbrunsdon, as we discussed on IRC
cc/ @athal7 who paired with me on this.