Moved code for payment process order to subscriptions module by adding a new filter

This commit is contained in:
Daniel Hüsken 2025-01-31 08:25:03 +01:00
parent b0a5d9b3c4
commit 99ca470d3f
No known key found for this signature in database
GPG key ID: 9F732DA37FA709E8
10 changed files with 127 additions and 34 deletions

View file

@ -230,7 +230,18 @@ class CheckoutOrderApproved implements RequestHandler {
}
try {
$this->order_processor->process( $wc_order );
/**
* This filter controls if the method 'precess()' from OrderProcessor will be called.
* So you can implement your own for example on subscriptions
*
* - true bool controls execution of 'OrderProcessor::precess()'
* @var $this \WC_Payment_Gateway
* @var $wc_order \WC_Order
*/
$process = apply_filters( 'woocommerce_paypal_payments_before_order_process', true, $this, $wc_order );
if ( $process ) {
$this->order_processor->process( $wc_order );
}
} catch ( RuntimeException $exception ) {
return $this->failure_response(
sprintf(