In the example of an affiliate:
Allocate a 20% commission on all sales,
If he has a coupon to give to the affiliate’s followers for 10% discount
Is it possible to calculate a commission minus the coupon discount? On orders where your coupon has been used?
If he has sales without the coupon the commission is 20%.
Thank you for your cooperation
Welcome back to our support forum.
The commission rate you mention in your example is a percentage and as such the commission will be a proportion of the sale total.
For example assume that the sale was referred via an affiliate link and the total is 100USD. The commission in this case will be 20USD for the referring affiliate.
On the second case assume that the sale was referred via an affiliate coupon -20% and the total is 100USD – 20USD = 80USD. The commission in this case will 16USD for the referring affiliate.
Still though if you wish to adjust the commissions even further ie whenever a coupon is used then you should have a look at Formula-based rates and the filter hook affiliates_formula_computer_variables which gives you the flexibility to adjust the final commission rate the way you like. The third parameter of the filter hook, $context, is an array which also includes the $order_id, giving you freedom to check the contents of a referred order, including coupons and decide what the commission should be according to your requirements.