1.8.1: a group's own coupon and the group discount do not stack
CI / WordPress latest + WooCommerce latest on PHP 8.3 (pull_request) Successful in 1m12s
Compatibility / WP latest / WC latest / PHP 7.4 (pull_request) Skipped
Compatibility / WP latest / WC beta / PHP 8.3 (pull_request) Skipped
Compatibility / WP latest / WC latest / PHP 8.3 (pull_request) Skipped
Compatibility / WP nightly / WC latest / PHP 8.3 (pull_request) Skipped
Compatibility / WP latest / WC latest / PHP 8.4 (pull_request) Skipped
Compatibility / Keep the compatibility headers honest (pull_request) Skipped
CI / Static checks (pull_request) Successful in 4m48s

A Netic member using the teamnetic coupon on garageristeriet.dk got 20%
from the coupon and then 20% off the remainder as an "Email discount"
fee: 36% in all. When a cart holds one of the coupons the group lists
under Shipping Rules -> Coupon codes, the group's percentage fee is
skipped and the coupon is the discount. Coupons the group does not list
stack as before.

Smoke tests: 104 assertions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
kristianwind
2026-11-18 12:33:20 +01:00
co-authored by Claude Opus 5.5
parent c2df6a0b48
commit 69f09574da
8 changed files with 37 additions and 8 deletions
+10
View File
@@ -263,6 +263,16 @@ class WC_EDM_Frontend {
return;
}
// 🔴 A group's own coupon and the group's percentage are the same deal
// offered two ways, never two deals. Before 1.8.1 a member who also
// typed the group's coupon got both: 20% off from the coupon, then 20%
// off what was left — 36% in all, on a live order. The coupon wins,
// because it is the discount the customer chose and can see.
$own_coupons = WC_EDM_DB::get_group_shipping_coupons( (int) $group->id );
if ( $own_coupons && array_intersect( $own_coupons, WC_EDM_DB::parse_coupon_list( implode( ',', $cart->get_applied_coupons() ) ) ) ) {
return;
}
$category_ids = WC_EDM_DB::get_group_category_ids( (int) $group->id );
if ( empty( $category_ids ) ) {