According to the compatibility table here, discount functions will not re-run when an order is edited in admin:
We’ve been alerted to the following behaviour, which seems at odds. Here’s an original order with a 10% order level discount:
If you edit the quantity on an existing/original line item, the discount value stays the same:

However, if you add a new item, it updates the discount to include that item:

However, if you were then to edit the quantity of an original cart line, the discount reverts to it’s original amount:

In fact, the ‘Amount to collect’ appears to take into account the discount value. Here, we increment an existing cart line by 1, but we only need to collect £4.50, instead of £5.
After completing the edit, the discount shows that it has been updated:
As I’m sure you can see by the above, there’s quite a lot of confusing/contradictory information being shown here.
There are other edge cases where this breaks. For example, in an ‘Order class’ discount, where you exclude specific ‘cart lines’. It’s possible to add an ‘invalid’ item to the order, which will then bypass the function logic (exclusions in this case).
Another example is a spend of £50 minimum, if you edit the order to take it below the threshold, the condition is not upheld, so it’s technically a loop hole.
I imagine this is awfully complex and the edge cases I’ve shown are just touch the surface.
I’d love to know:
1.) What is the expected behaviour here. Should the discount stay static, no matter what?
2.) Are there plans in the future to run functions on things like order editing/subscription payments?
This becomes extremely complicated when you think about discounts expiring, being changed by brands/merchants etc. It would be really handy to really understand the expected behaviour so that it can be relayed to brands/merchants.



