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: support new is_my_account() method from main plugin #1869

Merged
merged 3 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:

Currently, transactions completed from the "My Account" dashboard are not using the modal checkout flow. However, due to a fix in #1573 for express checkout flows, when completing a transaction from My Account that's also related to a subscription that originated with a modal checkout flow, these transactions are flagged as My Account transactions and show the modal checkout thank you template, but in a non-modal context, trapping the user in a dead-end.

This fix relies on a new method in Automattic/newspack-plugin#3389 that lets us determine if a checkout flow originated from My Account, and show the correct non-modal thank you template if so.

The better solution would be to use the modal checkout flow for My Account transactions too, but this is a bigger change than is appropriate for a hotfix.

How to test the changes in this Pull Request:

See testing instructions in Automattic/newspack-plugin#3389.

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 changed the base branch from trunk to release September 4, 2024 00:46
@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
empty( $modal_checkout_url ) ||
(
// Until we use the modal checkout flow from My Account, we don't want to show the modal checkout thank you template for checkouts originating from My Account.
method_exists( 'Newspack\WooCommerce_My_Account', 'is_from_my_account' ) && \Newspack\WooCommerce_My_Account::is_from_my_account()
Copy link
Member

Choose a reason for hiding this comment

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

When following the testing instructions, the successful result is never referred from my-account, but from /checkout. That might be why I'm not seeing what's expected here: Automattic/newspack-plugin#3389 (review)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hidden field added here should account for that. However, it won't work for express checkouts, and I'm not sure how we might pass that info along to express checkout requests...

Copy link
Contributor Author

@dkoo dkoo Sep 5, 2024

Choose a reason for hiding this comment

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

Fixed by 146917f

@dkoo dkoo requested review from adekbadek and 1Conan and removed request for 1Conan September 4, 2024 21:42
@dkoo
Copy link
Contributor Author

dkoo commented Sep 16, 2024

Marking approved based on @adekbadek's approval in the other PR.

@dkoo dkoo merged commit b9a3aba into release Sep 16, 2024
10 checks passed
@dkoo dkoo deleted the hotfix/my-account-post-checkout-redirect branch September 16, 2024 22:59
matticbot pushed a commit that referenced this pull request Sep 16, 2024
## [4.1.1](v4.1.0...v4.1.1) (2024-09-16)

### Bug Fixes

* support new is_my_account() method from main plugin ([#1869](#1869)) ([b9a3aba](b9a3aba))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Sep 16, 2024
# [4.2.0-alpha.2](v4.2.0-alpha.1...v4.2.0-alpha.2) (2024-09-16)

### Bug Fixes

* support new is_my_account() method from main plugin ([#1869](#1869)) ([b9a3aba](b9a3aba))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 4.2.0-alpha.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ronchambers
Copy link

ronchambers commented Sep 17, 2024

New bug posted here: Automattic/newspack-plugin#3426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants