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.
Say you have a sales tax of 5.125% and an item with a unit price of $0.34. If you buy 100 of those items and have 'Round tax at the order item level' on, then the tax amount will be $2.00. If you turn the 'Round tax at the order item level off', the tax is $1.7425. Then, when trying to capture payment using Braintree (I haven't tested other payment gateways) you'll get an error because the 'Amount' is invalid. Commerce sends an amount that isn't rounded ($35.7425).
Comment | File | Size | Author |
---|---|---|---|
#6 | commerce-round-order-total-2928828-6-D8.patch | 1.15 KB | mortona2k |
#5 | commerce-round-order-total-2928828-5-D8.patch | 859 bytes | mortona2k |
Comments
Comment #2
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedComment #3
flocondetoileIf you round tax at the order level then you should get errors too, in the case the order contains several order item with a tax rate different. May be the tax should be rounded at the level of the order item, but on the total price, not on the unit price of the order item. Thoughts ?
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedClarifying the title. We already have a setting on the tax type about order item / order rounding, the problem is just that the order part is not implemented.
Comment #5
mortona2k CreditAttribution: mortona2k commentedThis is just a hack to round the order total.
Comment #6
mortona2k CreditAttribution: mortona2k commentedThis one rounds each adjustment before adding to total.
Comment #7
bojanz CreditAttribution: bojanz at Centarro commented#2943961: Create a AdjustmentTransformer service for combining/sorting/rounding adjustments has added the necessary API functions for this, now we just need to use them.
Comment #9
bojanz CreditAttribution: bojanz at Centarro commentedDone. Thanks, everyone.