I’m curious about how WooCommerce distributes coupons within order items. I’ve generated a fixed cart coupon for $100 Coupon Details.
However, when I apply this coupon to an order, I’ve noticed that the coupon amount is divided among the order’s line items. I’m unclear about the logic WooCommerce uses to distribute the coupon amount. Is there a specific formula or method involved in this distribution process? Order Details
I attempted a solution where I evenly divided the coupon amount among each order item and then deducted this allocated coupon value from the subtotal of each item. However, this approach did not yield the desired results.
Here’s the formula I used:
- Coupon applied to each item = Total coupon amount / Number of order items
- Adjusted item total = Original item subtotal – Coupon applied to each item