diff --git a/services/class-wc-ebanx-helper.php b/services/class-wc-ebanx-helper.php index b821ac8f..eb9a67c3 100644 --- a/services/class-wc-ebanx-helper.php +++ b/services/class-wc-ebanx-helper.php @@ -129,14 +129,26 @@ public static function array_to_object( $array ) { * @return bool */ public static function checkout_contains_subscription() { - global $product; if ( class_exists( 'WC_Subscription' ) ) { - return WC_Subscriptions_Cart::cart_contains_subscription() || strpos( get_class( $product ), 'Subscription' ) !== false; + return WC_Subscriptions_Cart::cart_contains_subscription() || self::product_contains_subscription(); } return false; } + /** + * + * + * @return boolean + */ + private static function product_contains_subscription() { + global $product; + if ( is_null( $product ) ) { + return false; + } + return strpos( get_class( $product ), 'Subscription' ) !== false; + } + /** * * @param string $country_abbr