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

fix: required billing fields in My Account #3389

Merged
merged 5 commits into from
Sep 16, 2024

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Sep 4, 2024

All Submissions:

Changes proposed in this Pull Request:

Fixes a regression that broke the address-editing solution in #2835, and adds a new is_my_account hidden billing field to checkouts originating from My Account so that we can determine post-checkout if the checkout originated from My Account (because we can only get the referrer URL from the immediately preceding page, not two pages earlier).

Also fixes a bug where clicking "Renew Now" or "Pay Now" from My Account redirects to the My Account main page instead of allowing you to complete the renewal.

See Automattic/newspack-blocks#1869 too, which uses a fix from this PR.

How to test the changes in this Pull Request:

  1. Check out this branch and fix: support new is_my_account() method from main plugin newspack-blocks#1869.
  2. In Newspack > Reader Revenue > Donations, enable some but not all billing address fields.
  3. As a reader, purchase a subscription via a modal checkout flow (Donate or Checkout Button blocks). Confirm that the post-checkout thank you page shown here uses the modal checkout template.
  4. Log into My Account and visit Addresses. Edit your billing address and confirm that the fields here are only required if they're also required in Newspack > Reader Revenue > Donations (make sure to submit with empty optional fields to confirm the field validation, too).
  5. Also in My Account, visit My Subscription then Renew Now. Confirm that you're redirected to a Checkout form and NOT the My Account main page.
  6. In the checkout page that loads, confirm that billing address fields are only required if they're also required in Newspack > Reader Revenue > Donations. (In the future, we should make the checkout flow from My Account a modal checkout flow to avoid this UI discrepancy.)
  7. After completing the renewal, confirm that the "thank you" confirmation page does NOT use the modal checkout template. It should have the full site header and footer, and contain a link back to the main "My Account" page, like so:
Screenshot 2024-09-03 at 6 38 46 PM
  1. Smoke test a transaction via modal checkout using an express checkout method such as Apple Pay (see feat(modal-checkout): handle non-redirect-based flow (e.g. Apple Pay) newspack-blocks#1573 for testing instructions) and confirm that the post-checkout thank you page shown here uses the modal checkout template.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo self-assigned this Sep 4, 2024
@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Sep 4, 2024
@dkoo dkoo marked this pull request as ready for review September 4, 2024 00:51
@dkoo dkoo requested a review from a team as a code owner September 4, 2024 00:51
Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

In the checkout page that loads, confirm that billing address fields are only required if they're also required in Newspack > Reader Revenue > Donations.

Should all fields be displayed, but only some marked as required? In my testing, only the fields requried in Newspack > Reader Revenue > Donations are displayed. Not sure if that's how it's supposed to be.

After completing the renewal, confirm that the "thank you" confirmation page does NOT use the modal checkout template.

In my testing, the confirmation page does use the checkout template:

image

@dkoo
Copy link
Contributor Author

dkoo commented Sep 4, 2024

Should all fields be displayed, but only some marked as required? In my testing, only the fields requried in Newspack > Reader Revenue > Donations are displayed. Not sure if that's how it's supposed to be.

Yes, all billing fields should be displayed in the non-modal checkout page, but only the ones selected in Newspack > Reader Revenue > Donations should be required. (I didn't want to change the look of these flows too much at this point.)

In my testing, the confirmation page does use the checkout template:

I can't replicate, but maybe there's some scenario I'm not considering. Did you also check out the corresponding Blocks PR? If yes, and you're still seeing the modal checkout template after renewing from My Account, then what Woo version and payment gateway are you using?

Aha, something broke with donation subscriptions. Revisiting...

@dkoo
Copy link
Contributor Author

dkoo commented Sep 4, 2024

@adekbadek looks like the Blocks plugin has a redundant filter for checkout fields that affects donate checkouts in all contexts (not just modal checkout). This is removing the is_my_account hidden field that lets us show the non-modal thank you template after a My Account transaction.

788faa4 should remove that check, so that all fields continue to be shown for Donate products in non-modal checkouts, too.

The only scenario that isn't fixed is the one mentioned here (express checkouts via non-modal checkouts started from My Account but for renewals of subscriptions initially purchased via modal checkout), but this is such a specific edge case and one that has proven to be extremely difficult to solve that I don't think it should be a blocker for this fix. fixed by 146917f

@dkoo dkoo requested a review from adekbadek September 4, 2024 21:42
@dkoo
Copy link
Contributor Author

dkoo commented Sep 5, 2024

146917f and 5bbe764 change the approach to filter the checkout and payment URLs to add a my_account_checkout query param which is used to determine if the request started from a My Account page. This seems to be more reliable and also fixes the issue for express checkout methods as well.

Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Edit your billing address and confirm that the fields here are only required if they're also required in Newspack > Reader Revenue > Donations

This didn't work in my testing – WC uses the standard set of required fields when editing an address:

image image

The checkout behaves as expected, though, with all fields listed but only the ones selected in the RR wizard marked as required:

image

After completing the renewal, confirm that the "thank you" confirmation page does NOT use the modal checkout template. I

Yes, this works as described now.

@dkoo
Copy link
Contributor Author

dkoo commented Sep 6, 2024

@adekbadek doh, 183e4e4 should re-fix for editing billing address.

@dkoo dkoo requested a review from adekbadek September 6, 2024 16:48
@dkoo
Copy link
Contributor Author

dkoo commented Sep 12, 2024

Any further feedback on this, @adekbadek?

Copy link
Member

@adekbadek adekbadek left a comment

Choose a reason for hiding this comment

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

Sorry for the late reply! Re-tested and it works fine now.

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Sep 13, 2024
@dkoo
Copy link
Contributor Author

dkoo commented Sep 13, 2024

Thanks, @adekbadek! Holding for a Monday release.

@dkoo dkoo merged commit eb58c6b into release Sep 16, 2024
8 checks passed
@dkoo dkoo deleted the hotfix/my-account-billing-fields branch September 16, 2024 22:59
matticbot pushed a commit that referenced this pull request Sep 16, 2024
## [5.3.9](v5.3.8...v5.3.9) (2024-09-16)

### Bug Fixes

* required billing fields in My Account ([#3389](#3389)) ([eb58c6b](eb58c6b))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.3.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Sep 16, 2024
# [5.4.0-alpha.4](v5.4.0-alpha.3...v5.4.0-alpha.4) (2024-09-16)

### Bug Fixes

* **onboarding:** add expected localized variable for GAM setup ([#3420](#3420)) ([ed29b2b](ed29b2b))
* required billing fields in My Account ([#3389](#3389)) ([eb58c6b](eb58c6b))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.4.0-alpha.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants