mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Unselect saved card only on page load
If we do it on every form update/method switch, then e.g. if the user first selected a card, but then entered/edited the address, they may lose the selection (and maybe it could cause issues in other cases, if something else triggers update_checkout)
This commit is contained in:
parent
2e59248bf9
commit
c2b77b3cff
1 changed files with 6 additions and 3 deletions
|
@ -12,9 +12,14 @@ class CheckoutBootstap {
|
|||
}
|
||||
|
||||
init() {
|
||||
|
||||
this.render();
|
||||
|
||||
// Unselect saved card.
|
||||
// WC saves form values, so with our current UI it would be a bit weird
|
||||
// if the user paid with saved, then after some time tries to pay again,
|
||||
// but wants to enter a new card, and to do that they have to choose “Select payment” in the list.
|
||||
jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());
|
||||
|
||||
jQuery(document.body).on('updated_checkout', () => {
|
||||
this.render()
|
||||
});
|
||||
|
@ -65,8 +70,6 @@ class CheckoutBootstap {
|
|||
}
|
||||
|
||||
switchBetweenPayPalandOrderButton() {
|
||||
jQuery('#saved-credit-card').val(jQuery('#saved-credit-card option:first').val());
|
||||
|
||||
const currentPaymentMethod = this.currentPaymentMethod();
|
||||
|
||||
if (currentPaymentMethod !== 'ppcp-gateway' && currentPaymentMethod !== 'ppcp-credit-card-gateway') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue