Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to save card with account creation #3901

Merged
merged 4 commits into from
Feb 28, 2025

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Feb 17, 2025

Fixes #2832

Changes proposed in this Pull Request:

  1. Included the saved token related HTML to the dom in a21617f. Without this the tokenization-form from WooCommerce Core does not get initialized. This block of code in core handles showing/hiding the save payment method checkbox with the change of the create account checkbox.
  2. I have hidden the save payment method checkbox in 02cb679 using the style property when the user is logged out.

Testing instructions

  • Enable account creation during checkout from WooCommerce > Settings > Accounts & Privacy.
  • Enable card payment method in Stripe settings page.
  • As a new shopper, add a product to your cart and go to the shortcode checkout page.
  • select the Create an account checkbox.
  • In develop branch, notice that the Save payment information to my account for future purchases` checkbox does not appear in the card element.
  • In this branch, confirm that the save payment information checkbox appears when you select the Create an account checkbox.
  • Choose to create an account and save the card. Confirm that the card is saved in this shopper's account.
  • Confirm that the card does not get saved if you do not choose to save the card.
  • Now login to the shop as a registered customer.
  • Make sure you have a few saved cards, if not save a few cards in My Account > Payment methods page.
  • Add a product to your cart and go to the shortcode checkout page.
  • Confirm that the saved cards are listed in the card element and you can also choose to use a new card.

@Mayisha Mayisha marked this pull request as draft February 17, 2025 05:01
@Mayisha Mayisha force-pushed the fix/2832-save-card-with-account-creation branch from 1539b2c to 30f1eab Compare February 27, 2025 16:09
@Mayisha Mayisha marked this pull request as ready for review February 27, 2025 16:12
@Mayisha Mayisha requested a review from diegocurbelo February 27, 2025 16:12
Copy link
Member

@diegocurbelo diegocurbelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good, and it tests well, the checkbox is visible after selecting to create an account and the payment method is correctly saved to the new user:

Screenshot 2025-02-27 at 18 46 13
Screenshot 2025-02-27 at 18 46 09

@Mayisha Mayisha merged commit 8f0fb61 into develop Feb 28, 2025
41 checks passed
@Mayisha Mayisha deleted the fix/2832-save-card-with-account-creation branch February 28, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Payment card does not save if Issue an authorization on checkout, and capture later is enabled
2 participants