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
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:
co-authored by
Claude Opus 5.5
parent
c2df6a0b48
commit
69f09574da
@@ -393,6 +393,22 @@ wc_edm_is(
|
||||
array( 'local_pickup:2' ),
|
||||
array_keys( wc_edm()->frontend->filter_shipping_rates( $wc_edm_ship_rates, array() ) )
|
||||
);
|
||||
// 🔴 A member using the group's own coupon gets the coupon OR the group's
|
||||
// percentage, never both. Before 1.8.1 they stacked: a live order took 20% from
|
||||
// the coupon and then 20% of what was left, 36% in all.
|
||||
wc_edm_cart_for( '[email protected]', array( $fixtures['product_in'] => 1, $fixtures['product_out'] => 1 ) );
|
||||
wc_edm_is( 'a group member without the coupon gets the group discount', 20.0, wc_edm_discount_total() );
|
||||
WC()->cart->apply_coupon( 'ciflat10' );
|
||||
WC()->cart->calculate_totals();
|
||||
wc_edm_is( 'with the group own coupon the group discount steps aside', 0.0, wc_edm_discount_total() );
|
||||
wc_edm_is( 'and the coupon discount is what they get', 10.0, round( WC()->cart->get_discount_total(), 2 ) );
|
||||
WC_EDM_DB::set_group_shipping_coupons( (int) $fixtures['group_id'], array() );
|
||||
WC()->cart->calculate_totals();
|
||||
// 19, not 20: stacked, the group takes its 20% of what the 10 kr coupon left.
|
||||
wc_edm_is( 'a coupon the group does not list still stacks as before', 19.0, wc_edm_discount_total() );
|
||||
WC()->cart->remove_coupons();
|
||||
WC()->cart->calculate_totals();
|
||||
|
||||
WC_EDM_DB::set_group_shipping_coupons( (int) $fixtures['group_id'], array() );
|
||||
wc_edm_is( 'an empty list unlinks the coupon', 0, WC_EDM_DB::group_for_coupons( array( 'ciflat10' ) ) );
|
||||
WC_EDM_DB::replace_shipping_rules( (int) $fixtures['group_id'], array() );
|
||||
|
||||
Reference in New Issue
Block a user