From bb91be119a783199441a8e098c3f25aad4d90593 Mon Sep 17 00:00:00 2001 From: David Stone Date: Tue, 24 Mar 2026 16:16:13 -0600 Subject: [PATCH] fix: coupon removal button and duplicate field ID on checkout form - Fix Remove button in order summary not working: the click handler now also resets toggle_discount_code to false, collapsing the coupon input field and properly clearing the applied coupon state (issue #76) - Fix coupon code field not rendering correctly: the toggle checkbox had id='discount_code' (same as the text input), causing a duplicate HTML id='field-discount_code'. Changed toggle id to 'discount_code_checkbox' to eliminate the duplicate and fix label/field association (issue #76) Closes #76 --- inc/checkout/signup-fields/class-signup-field-discount-code.php | 2 +- views/checkout/templates/order-summary/simple.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/checkout/signup-fields/class-signup-field-discount-code.php b/inc/checkout/signup-fields/class-signup-field-discount-code.php index cbf751269..0e70eb469 100644 --- a/inc/checkout/signup-fields/class-signup-field-discount-code.php +++ b/inc/checkout/signup-fields/class-signup-field-discount-code.php @@ -166,7 +166,7 @@ public function to_fields_array($attributes) { $checkout_fields = []; $checkout_fields['discount_code_checkbox'] = [ - 'id' => 'discount_code', + 'id' => 'discount_code_checkbox', 'type' => 'toggle', 'name' => __('Have a coupon code?', 'ultimate-multisite'), 'class' => 'wu-w-auto', diff --git a/views/checkout/templates/order-summary/simple.php b/views/checkout/templates/order-summary/simple.php index e48204b22..8c2abcd69 100644 --- a/views/checkout/templates/order-summary/simple.php +++ b/views/checkout/templates/order-summary/simple.php @@ -259,7 +259,7 @@ printf(esc_html__('Discount applied: %1$s - %2$s (%3$s) %4$s', 'ultimate-multisite'), '{{ order.discount_code.name }}', '{{ order.discount_code.code }}', '{{ order.discount_code.discount_description }}', '{{ wu_format_money(-order.totals.total_discounts) }}'); ?> - +