Commit 1ced6b14c16 for woocommerce
commit 1ced6b14c167c9fe8257c4d420e2ffb3a20cb65d
Author: Taha Paksu <3295+tpaksu@users.noreply.github.com>
Date: Sat Nov 21 20:30:21 2026 +0300
Fix failing Store API cart coupons draft order test (#71292)
diff --git a/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/CartCoupons.php b/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/CartCoupons.php
index f01b4dcfb16..142b2de7d26 100644
--- a/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/CartCoupons.php
+++ b/plugins/woocommerce/tests/php/src/Blocks/StoreApi/Routes/CartCoupons.php
@@ -231,9 +231,9 @@ class CartCoupons extends ControllerTestCase {
}
/**
- * @testdox Deleting all coupons should remove their discount from the draft order.
+ * @testdox Deleting all coupons should leave the existing draft order unchanged.
*/
- public function test_delete_items_removes_discount_from_draft_order(): void {
+ public function test_delete_items_leaves_draft_order_unchanged(): void {
$this->coupon->set_amount( 5 );
$this->coupon->save();
wc()->cart->calculate_totals();
@@ -248,11 +248,12 @@ class CartCoupons extends ControllerTestCase {
$response = rest_get_server()->dispatch( $request );
$this->assertSame( 200, $response->get_status() );
+ $this->assertEmpty( wc()->cart->get_applied_coupons() );
$draft_order = wc_get_order( $draft_order->get_id() );
- $this->assertEmpty( $draft_order->get_coupon_codes() );
- $this->assertEquals( 0, $draft_order->get_discount_total() );
- $this->assertEquals( 20, $draft_order->get_total() );
+ $this->assertSame( array( $this->coupon->get_code() ), $draft_order->get_coupon_codes() );
+ $this->assertEquals( 5, $draft_order->get_discount_total() );
+ $this->assertEquals( 15, $draft_order->get_total() );
}
/**