Overhauling the PPE review/confirmation process #3116
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.
All Submissions:
Changes proposed in this Pull Request:
Currently, our PayPal Express integration relies heavily on the existing checkout preheader flow and checkout page template. This reliance complicates updates to the checkout flow, as PPE functions differently from other gateways. The main issues are:
• Use of the
pmpro_checkout_confirmed
hook to modify data in the checkout preheader during processing.• Dependency on the review order status and the
$pmpro_review
global variable throughout the checkout preheader and page template.This PR addresses these issues with the following changes:
Deprecation of
pmpro_checkout_confirmed
Hook:The
pmpro_checkout_confirmed
hook is deprecated. Its logic is now handled using thepmpro_checkout_preheader
hook and the gateway class’process()
method. These are the preferred hooks for future gateway integrations.Enhanced Use of
$pmpro_review
Variable:Instead of eliminating the
$pmpro_review
variable, this PR leverages it further. The goal is to eventually separate the payment step from the rest of the checkout process, showing only payment fields while hiding account fields and other checkout boxes.The
$pmpro_review
variable can now store aMemberOrder
object, representing a pending order where payment has not yet been completed. When atoken
order is passed into the checkout preheader and assigned to$pmpro_review
, only the payment fields are displayed at checkout. Currently, this functionality is specific to PPE in the checkout page template but sets the stage for broader use across all gateways.Backward-Compatibility and Future Vision:
Importantly, these changes do not alter the checkout page template, ensuring backward compatibility with existing custom templates. This allows for inclusion in a minor PMPro release. Further updates to the checkout page template could then enable new “multi-step payment” gateways in subsequent minor releases.
Other information:
Changelog entry