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

Change the logic flow for the order confirmation thankyou screen #39406

Closed
wants to merge 6 commits into from

Conversation

coreymckrill
Copy link
Collaborator

@coreymckrill coreymckrill commented Jul 25, 2023

Changes proposed in this Pull Request:

On the heels of #38983 and #39191, this changes the flow a bit so that the "thank you" message will always be shown when loading the "order received" URL. However, the verification requirement still prevents the details of the order being shown unless the customer is verified, either by confirming the email or by logging in. If unverified, the login/email form is shown on the thank you screen instead of the details of the order.

This attempts to solve cases where a newly created order has a customer record attached to it (i.e. is not a guest checkout) but the customer is not actually logged in. Currently this can cause the customer to see a login screen right after completing checkout, rather than an acknowledgment that the order has been received. This ensures that the customer gets that acknowledgment. Further, it allows developers to modify this part of their custom checkout flows, if necessary, by customizing the thankyou template file.

See this conversation for more details on the issues this is attempting to resolve.

To do

  • If this seems like a worthwhile change to pursue, the e2e tests will probably need to be updated.

How to test the changes in this Pull Request:

The instructions in #39191 apply to this PR as well. The only change should be that the "Thank you. Your order has been received." message should be shown even when viewed as an unverified customer.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Change the order confirmation screen to always show the 'Thank you for your order' message, even if the viewer must log in or confirm the order email to see the details of the order.

Comment

@coreymckrill coreymckrill self-assigned this Jul 25, 2023
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jul 25, 2023
@github-actions
Copy link
Contributor

Hi @barryhughes,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Jul 25, 2023

Test Results Summary

Commit SHA: 3b782fe

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202611m 9s
E2E Tests1890019020815m 59s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Member

@barryhughes barryhughes left a comment

Choose a reason for hiding this comment

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

This seems like a nice tweak, since we always acknowledge the order was received. Left a suggestion, otherwise I think this is worth moving ahead with.

On the heels of #38983 and #39191, this changes the flow a bit so that
the "thank you" message will always be shown when loading the "order
received" URL. However, the verification requirement still prevents
the details of the order being shown unless the customer is verified,
either by confirming the email or by logging in. If unverified, the
login/email form is shown on the thank you screen instead of the order
details.
coreymckrill and others added 3 commits August 1, 2023 15:46
Co-authored-by: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
@coreymckrill coreymckrill marked this pull request as ready for review August 1, 2023 22:55
@coreymckrill coreymckrill reopened this Aug 2, 2023
@coreymckrill
Copy link
Collaborator Author

@barryhughes Ok, I committed your suggestion and fixed up some phpcs issues. This is ready for another pass.

Copy link
Member

@barryhughes barryhughes left a comment

Choose a reason for hiding this comment

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

Something I think we should pause and consider (apologies for not raising this during my first pass) is that, in 7.9.0, if we decided extra verification was needed before showing the order details we would either:

We then returned early and did not render any of the thankyou template. Whereas, in this change, we always render at least some of the thankyou template (and of course it may return early after embedding either of the above).

I think this may work against the motivation for adding verification checks because, if the order exists but the shopper is unverified, we are still going to trigger the woocommerce_before_thankyou action via code found close to the start of the thankyou template (and a third party extension or similar may unwittingly expose information via that hook that perhaps should not be exposed to the as-yet unverified visitor).

There's also some asymmetry in these scenarios where verification is needed in the sense that we do still trigger woocommerce_before_thankyou but not woocommerce_thankyou_<METHOD> or woocommerce_thankyou. However, this is less of a concern than the previous point.

What do you think of an alternative in which we essentially roll back to the previous structure, but add the 'your order has been received' messaging before rendering either the email verification or login forms?

Also, though far less pressing/less essential: the 'your order has been received' verbiage and its accompanying hook is already duplicated twice, so that could possibly also be encapsulated into a function of its own.

@barryhughes
Copy link
Member

...yet another alternative could be restructuring the template to something like:

if ( order ) {
    # PRINT THANK YOU/ORDER RECEIVED

    if ( needs_verification ) {
        # VERIFICATION
    } else {
        # SHOW ORDER DETAILS
    }
} else {
    # FINAL FALLBACK
}

With the possible disadvantage that sites with existing template overrides will not gain this additional layer of protection.

coreymckrill added a commit that referenced this pull request Aug 15, 2023
As an alternative to #39406, this tries to solve the same issue in a
simpler way: break the "thank you" message out into its own small
template file and just include it in more places, so that no matter
the context, the order confirmation screen will always say thank you,
acknowledging that the order data has been received.
@coreymckrill
Copy link
Collaborator Author

@barryhughes

What do you think of an alternative in which we essentially roll back to the previous structure, but add the 'your order has been received' messaging before rendering either the email verification or login forms?

Also, though far less pressing/less essential: the 'your order has been received' verbiage and its accompanying hook is already duplicated twice, so that could possibly also be encapsulated into a function of its own.

This sounded worth trying, so I've opened #39758 as an alternative to this, and added you as the reviewer.

@barryhughes
Copy link
Member

samueljseay pushed a commit that referenced this pull request Aug 18, 2023
As an alternative to #39406, this tries to solve the same issue in a
simpler way: break the "thank you" message out into its own small
template file and just include it in more places, so that no matter
the context, the order confirmation screen will always say thank you,
acknowledging that the order data has been received.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants