Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the BNPL PMME doesn't appear on carts with subscriptions #9774

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/fix-no-bnpl-subscriptions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Small fix for BNPL messaging element.


5 changes: 3 additions & 2 deletions includes/class-wc-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -1880,10 +1880,11 @@ public static function load_stripe_bnpl_site_messaging() {
$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 );
$is_subscription = $product && WC_Subscriptions_Product::is_subscription( $product );
$cart_contains_subscription = is_cart() && WC_Subscriptions_Cart::cart_contains_subscription();
}

if ( ! $is_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' );
Expand Down
Loading