diff --git a/changelog/fix-fatal-errors-when-subscriptions-are-unavailable b/changelog/fix-fatal-errors-when-subscriptions-are-unavailable new file mode 100644 index 00000000000..aa457b9b6f0 --- /dev/null +++ b/changelog/fix-fatal-errors-when-subscriptions-are-unavailable @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fixing fatal errors when subscription classes are not available diff --git a/includes/subscriptions/class-wc-payments-subscription-service.php b/includes/subscriptions/class-wc-payments-subscription-service.php index 229bef20ae7..b68bd99cbbe 100644 --- a/includes/subscriptions/class-wc-payments-subscription-service.php +++ b/includes/subscriptions/class-wc-payments-subscription-service.php @@ -1080,6 +1080,10 @@ private function validate_subscription_data( $subscription_data ) { * @return bool True if store has active WCPay subscriptions, otherwise false. */ public static function store_has_active_wcpay_subscriptions() { + if ( ! function_exists( 'wcs_get_subscriptions' ) ) { + return false; + } + $active_wcpay_subscriptions = wcs_get_subscriptions( [ 'subscriptions_per_page' => 1,