Commerce: Negative Order Totals

Created on 24 Jan 2019  ·  3Comments  ·  Source: craftcms/commerce

At the moment if too many discounts, or negative order adjustments are made the order total can end up being negative. Usually this can be fixed by careful creation of discount rules and adjustments.

We have a couple of options.

1) Force all adjusters (including the core discount adjuster and 3rd party adjusters) to consider the order total and never adjust amounts that would cause a negative total.

2) Allow a negative order total, but have the total price due to never be less than zero (seperate totalPrice into totalPriceDue and totalPrice) never.

Most helpful comment

This has been resolved in c5e955911afeef3c5f5abac542f86ffadc6deb90

  • Added a “Minimum Total Price Strategy” setting that allows the minimum order price be negative (default), at least zero, or at least the shipping cost. (#651)
  • Added craft\commerce\elements\Order::getTotal() to get the price of the order before any pricing strategies.

All 3 comments

Hi! Is there an ETA on this issue? This is a HUGE issue for our client, and I can't find a workaround that doesn't require forking commerce.

Why would you allow negative charges at all? I'd wager a guess that most payment gateways also don't support this.

Could you call getItemSubTotal inside getAdjustmentsTotal and then compare the internally calculated adjustment amount and reduce it so the total price is exactly 0 when it's negative? Please at least add a config option to allow this, that way you wouldn't break existing setups.

Would this be fixed by doing a check at the last moment and if the total is less than 0 then set it to 0 by means of an additional adjuster that has a value of whatever the difference is?

This has been resolved in c5e955911afeef3c5f5abac542f86ffadc6deb90

  • Added a “Minimum Total Price Strategy” setting that allows the minimum order price be negative (default), at least zero, or at least the shipping cost. (#651)
  • Added craft\commerce\elements\Order::getTotal() to get the price of the order before any pricing strategies.
Was this page helpful?
0 / 5 - 0 ratings