Initialise customer sessions on the order pay page #43858
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Submission Review Guidelines:
Changes proposed in this Pull Request:
Logged-out customers only have a WooCommerce session initialised when they have a cart. Some pages, such as the order pay page, may require a session outside of the regular cart flow.
To negate the need for extensions to handle this case themselves, this PR sets the session on the order pay page.
Closes #23902
Because I'm not certain what payment gateways/extensions need this, I tested using a small snippet instead to ensure a session was set.
This will output
Hello
in the header after refreshing the page only if a session is set. Otherwise it will showNULL
.How to test the changes in this Pull Request:
Testers only need to test for regressions. Run through the checkout flow as a logged out guest user and ensure there are no errors.
Developer testing
NULL
at the top of the page indicating there is no session.https://store.local/checkout/order-pay/18/?pay_for_order=true&key=123);
hello
in the header instead ofnull
. This means you now have a session.Changelog entry
Significance
Type
Message
Fix to ensure all customers have a session when visiting the order pay page.
Comment