owner232
Forum Replies Created
-
Hi @komal-maru,
I can confirm this bug and add a CheckoutWC-specific reproduction from the released plugin.
Environment:
- Payment Gateway Based Fees and Discounts for WooCommerce 3.2.0
- CheckoutWC 11.3.0
- WooCommerce 10.9.4
- WordPress 7.0.2
- Android Chrome/mobile viewport
- Hosted iframe card gateway
CheckoutWC impact:
- On a fresh mobile checkout, selecting the embedded Credit Card gateway can leave all three visible card containers blank because the secure iframes are removed during the extra checkout refresh.
- After the failure, switching to other gateways and clicking Place Order/Complete Order may do nothing until the page is refreshed.
- Gateway-based 10% discounts can also stop updating because all payment radios have been overwritten with the same value.
The original handler has two separate problems:
- .val(methodSelected) mutates every payment_method radio value.
- trigger(‘change’) on the collection dispatches repeated change/update cycles. In CheckoutWC, those updates replace the payment-method DOM while hosted fields are mounting.
Important fix detail: changing the last line only to:
$(‘input[name=”payment_method”]:checked’).trigger(‘change’);
prevented sibling value corruption, but it was still insufficient with CheckoutWC because it caused a redundant update cycle and the hosted fields could still be torn down. Removing the entire payment_method_selected handler was required in our test. The existing change/update logic continued to apply and remove gateway discounts correctly without that handler.
Verification after removing the handler and cache-busting the asset:
- every payment radio retained its original gateway ID;
- all three secure card iframes mounted on the first mobile load;
- alternate gateways remained selectable and Place Order worked normally;
- the alternative payment method discounts displayed again;
- no card data or live order was submitted during testing.
Please ensure the ZIP/final release does not merely retarget the same trigger to :checked, and add a CheckoutWC regression test confirming that selecting a gateway neither mutates sibling radio values nor causes a second payment DOM refresh.
Thank you.