woocommerce / woocommerce-paypal-payments

https://wordpress.org/plugins/woocommerce-paypal-payments/
GNU General Public License v2.0
61 stars 47 forks source link

ACDC Block - Credit card is not saved when subscription product is bought as a guest (3213) #2323

Closed Dinamiko closed 1 month ago

Dinamiko commented 1 month ago

When buying a subscription type product as a guest while ACDC Vaulting is active, the payment method is not saved for the newly created WordPress user.

Steps To Reproduce

Navigate to MyAccount → Payment methods Observe no saved payment methods in list

Expected behaviour

Payment method is saved a guest user creates an account during the checkout, eg. when buying a subscription type product.

Possible cause

Current localStorage implementation for save payment method check does not work correctly for guest users, it send save_payment_method as false.

Suggested solution

EnsurelocalStorage sets true on page load when there is a WC subscription product in the cart. It also removes localStorage key on page load to avoid previous value being used.