I have a discount code that gives a client 20 euro discount on an order, if the cart contains a specific SKU (this is just an example, it could also be an attribute color with the value blue).
This works, so far so good.
Then an order gets placed with 2 products and the customer decides to return the product with the sku 'TEST15335' (which is in the conditions).
So I create a creditmemo with the following settings;
The problem is immediately apparent; the discount of 20 euro is spread out over the products in the cart, based on the percentage of the product price of the total.
The first product percentage of total is;
79.95 / 129.90 * 100 = 61.547344111
So the discount for that row is;
20 * 0.61547344111 ~= 12.31
So when I refund this, 12.31 discount will be 'refunded'. The problem is; without this product in the cart, the total discount of 20 euro should not be applied, so the discount that will be 'refunded' should be 20 instead of 12.31. Is there any way to re-validate the discount code when the creditmemo is created so the full amount will be 'refunded' ?
I am aware of the functionality that you can apply discounts on specific items in the cart by utilising the 'Apply the rule only to cart items matching the following conditions (leave blank for all items' field under 'Actions', and that will work in this specific case but there are cases where it might not so I'd like a more generic approach for this (which will then include already placed orders with a coupon code that is 'configured incorrectly').
Edit; an example would be a 20 euro discount when the cart subtotal is larger than 75 euro. The subtotal would then be 55 euro. After returning a product that causes the non-discount subtotal to dip below 75 euro, only the discount for that product is 'refunded'.