Open BusinessBloomer opened 2 years ago
p.s. The exact same bug happens with the new WooCommerce PayPal Payments plugin: if on load PayPal is unset, and I switch shipping rate, PayPal appears but displays no buttons
I have found a relative problematic behavior when the payment method is getting hidden. Whichever option i choose after the payment option gets hidden, it takes me to my credit card payment option... Which on 1st position after unsetting 'woocommerce_payments'.
I'm sure it's too late. but the code is limited to an environment outside of the manager! is_admin() and the ajax response is done within the admin. Therefore the answer does not include the code inside if(!is_admin()) statement
How to reproduce the issue:
1) use woocommerce_available_payment_gateways to disable WooCommerce Payments when a certain shipping method is selected e.g. from https://www.businessbloomer.com/woocommerce-disable-payment-gateway-for-specific-shipping-method/:
2) all good, but in a scenario the bug occurs: select the shipping method that hides WooCommerce Payments @ Cart, go to Checkout, so that the shipping method is selected and WooCommerce Payments is hidden (so, woocommerce_available_payment_gateways triggers ok).
Now, switch shipping rate, so that WooCommerce Payments appears again (woocommerce_available_payment_gateways triggers ok again). The Credit Card form does not load: https://www.screencast.com/t/SkvyVs0RXdc6
Basically, it seems that “on checkout load”, if the WooCommerce Gateway is unset, whatever Stripe JS does not run. When you switch shipping and WooCommerce Payments appear back, this JS does not load, and therefore there is no payment card form
Are you able to replicate this?