From 9cfa8fa92268aefcb734b654ae9d565ab3e1c968 Mon Sep 17 00:00:00 2001 From: dinamiko Date: Fri, 21 May 2021 11:19:00 +0200 Subject: [PATCH] Check if `wcs_get_subscription` exists before calling it --- modules/ppcp-subscription/src/class-renewalhandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-subscription/src/class-renewalhandler.php b/modules/ppcp-subscription/src/class-renewalhandler.php index af23691b6..afa2aa4e3 100644 --- a/modules/ppcp-subscription/src/class-renewalhandler.php +++ b/modules/ppcp-subscription/src/class-renewalhandler.php @@ -203,7 +203,7 @@ class RenewalHandler { ); } - $subscription = wcs_get_subscription( $wc_order->get_meta( '_subscription_renewal' ) ); + $subscription = function_exists( 'wcs_get_subscription' ) ? wcs_get_subscription( $wc_order->get_meta( '_subscription_renewal' ) ) : null; if ( $subscription ) { $subscription_id = $subscription->get_id(); $token_id = get_post_meta( $subscription_id, 'payment_token_id', true );