Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is a post-RC1 task.
Right now OrderPercentageOff just adds an order-level adjustment.
Instead, we should add an adjustment to each order item + an order-level adjustment for the rest (such as shipping costs. We achieve the same numbers, but optimize for better refunds, cause the order item's adjusted price will now be more precise (showing the applied promotion).
Comment | File | Size | Author |
---|---|---|---|
#12 | order_offers_should-2865701-12.patch | 9.06 KB | edurenye |
#9 | order_offers_should-2865701-9.patch | 8.96 KB | swickham |
#4 | orderpercentageoff-2865701-4.patch | 1.63 KB | mglaman |
Comments
Comment #2
smccabe CreditAttribution: smccabe as a volunteer and at Acro Commerce commentedWould this also allow us to do stuff like not discount shipping but discount the order, or would that be an additional issue? With this change it would just be a simple config toggle?
Comment #3
mglamanWe need this for our implementation. We need to pass the adjusted unit price to a remote service which does its own quantity multiplication.
Comment #4
mglamanPatch, will make PR later.
Comment #5
mglamanWe should also fix order_fixed_amount_off
Comment #6
bojanz CreditAttribution: bojanz at Centarro commentedWe need to add promotion adjustments for any positive order adjustments as well.
If the order has a $20 shipping cost, then that needs to be reduced too for the order total to be correct, same for fees.
Comment #7
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedAdding related issues.
#2896066: Allow the OrderPercentageOff offer to reduce shipping costs and other adjustments is related because of the comment in #2.
#2897190: Tax calculations do not take discounts (promotions) into account is related because I think that an order based discount should be divided per ratio over the individual order items. The reason for this is to be able to calculate taxes based on the product price inclusive discount.
Comment #8
swickham CreditAttribution: swickham at Acro Commerce commentedI can get at this over the weekend.
Comment #9
swickham CreditAttribution: swickham at Acro Commerce commentedHere's what I have so far but it's not complete. The issue:
Discounts to items like shipping need to be applied to the order itself since adjustments can't have adjustments applied to them like order items can. This causes an issue when calculating percentage discounts since the percentage needs to be based off their discounted value otherwise you end up with too high of a discount, assuming the percentage should come off their adjusted amount.
I can either use the same kind of calculations like I did in the OrderFixedAmountOff plugin to make sure the discounts on the order are applied evenly amongst the items but that's starting to feel sloppy.
Should we consider making it so adjustments can have adjustments applied to them?
Comment #10
bojanz CreditAttribution: bojanz at Centarro commentedNote that order promotions now apply to the subtotal, excluding shipping and other adjustments: #2926559: Apply order promotions to the subtotal, not the total.
That should make this issue easer to achieve. Matt's percentage part already looks good, we just need to work on the fixed one.
Comment #11
swickham CreditAttribution: swickham at Acro Commerce commentedComment #12
edurenye CreditAttribution: edurenye at ENDPHASYS Technologies commentedJust rerolled, I didn't tested it yet.
Comment #14
bojanz CreditAttribution: bojanz at Centarro commentedLet's split this up and get it in.
Opened #2980195: Fixed order offers should reduce each order item for the fixed offers, and we'll do percentage offers here.
Comment #16
bojanz CreditAttribution: bojanz at Centarro commentedHad to completely rebuild the patch, the underlying code changed too much.
Thanks, everyone! See you in #2980195: Fixed order offers should reduce each order item.