I kept the variable in place and only added a default value at the beginning of the function:
/**
* Load stripe site messaging script.
*
* @return void
*/
public static function load_stripe_bnpl_site_messaging() {
// The messaging element shall not be shown for subscription products.
// As we are not too deep into subscriptions API, we follow simplistic approach for now.
$is_subscription = false;
$cart_contains_subscription = false; // this line is the new one :)
$are_subscriptions_enabled = class_exists( 'WC_Subscriptions' ) || class_exists( 'WC_Subscriptions_Core_Plugin' );
if ( $are_subscriptions_enabled ) {
global $product;
$is_subscription = $product && WC_Subscriptions_Product::is_subscription( $product );
$cart_contains_subscription = is_cart() && WC_Subscriptions_Cart::cart_contains_subscription();
}
if ( ! $is_subscription && ! $cart_contains_subscription ) {
require_once __DIR__ . '/class-wc-payments-payment-method-messaging-element.php';
$stripe_site_messaging = new WC_Payments_Payment_Method_Messaging_Element( self::$account, self::$card_gateway );
echo wp_kses( $stripe_site_messaging->init() ?? '', 'post' );
}
}
-
This reply was modified 1 year, 4 months ago by
falkemediawy.
Zee
(@doublezed2)
Hello falkemediawy,
Thank you for contacting WooCommerce support.
I appreciate your time and effort in reporting this issue along with the solution.
It is already being helpful for other users.
I will double-check this issue and notify the relevant team.
Have a great day!
We have a fix for this going out in the next release. 🙂
Thank you for the quick fix @adamkheckler !