mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
Merge pull request #3245 from woocommerce/PCP-4350-a-s-pre-execution-callback-can-result-in-fatal-error-subscriptions
Remove `action_scheduler_before_execute` code (4350)
This commit is contained in:
commit
39c8cc88b9
1 changed files with 0 additions and 29 deletions
|
@ -645,35 +645,6 @@ class PayPalSubscriptionsModule implements ServiceModule, ExtendingModule, Execu
|
||||||
2
|
2
|
||||||
);
|
);
|
||||||
|
|
||||||
add_action(
|
|
||||||
'action_scheduler_before_execute',
|
|
||||||
/**
|
|
||||||
* Param types removed to avoid third-party issues.
|
|
||||||
*
|
|
||||||
* @psalm-suppress MissingClosureParamType
|
|
||||||
*/
|
|
||||||
function( $action_id ) {
|
|
||||||
/**
|
|
||||||
* Class exist in WooCommerce.
|
|
||||||
*
|
|
||||||
* @psalm-suppress UndefinedClass
|
|
||||||
*/
|
|
||||||
$store = ActionScheduler_Store::instance();
|
|
||||||
$action = $store->fetch_action( $action_id );
|
|
||||||
|
|
||||||
$subscription_id = $action->get_args()['subscription_id'] ?? null;
|
|
||||||
if ( $subscription_id ) {
|
|
||||||
$subscription = wcs_get_subscription( $subscription_id );
|
|
||||||
if ( is_a( $subscription, WC_Subscription::class ) ) {
|
|
||||||
$paypal_subscription_id = $subscription->get_meta( 'ppcp_subscription' ) ?? '';
|
|
||||||
if ( $paypal_subscription_id ) {
|
|
||||||
as_unschedule_action( $action->get_hook(), $action->get_args() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue