Skip to content

Commit 169787f

Browse files
kalessilmgascam
andauthored
Affirm&Afterpay: refactor subscription product detection. (#6605)
Co-authored-by: Miguel Gasca <[email protected]>
1 parent fbe5b88 commit 169787f

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: dev
3+
4+
Affirm&Afterpay: refactor subscription products detection by using existing subs API

includes/class-wc-payments.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,9 +1660,8 @@ public static function load_stripe_bnpl_site_messaging() {
16601660
$is_subscription = false;
16611661
$are_subscriptions_enabled = class_exists( 'WC_Subscriptions' ) || class_exists( 'WC_Subscriptions_Core_Plugin' );
16621662
if ( $are_subscriptions_enabled ) {
1663-
// The subscription identification shall be aligned with WC_Subscriptions_Product::is_subscription.
16641663
global $product;
1665-
$is_subscription = $product && $product->is_type( [ 'subscription', 'subscription_variation', 'variable-subscription' ] );
1664+
$is_subscription = $product && WC_Subscriptions_Product::is_subscription( $product );
16661665
}
16671666

16681667
if ( ! $is_subscription ) {

psalm-baseline.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<code>WC_Subscriptions_Product</code>
3232
</UndefinedClass>
3333
</file>
34+
<file src="includes/class-wc-payments.php">
35+
<UndefinedClass occurrences="1">
36+
<code>WC_Subscriptions_Product</code>
37+
</UndefinedClass>
38+
</file>
3439
<file src="includes/multi-currency/Compatibility/WooCommerceProductAddOns.php">
3540
<UndefinedClass occurrences="2">
3641
<code>\WC_Product_Addons_Helper</code>

0 commit comments

Comments
 (0)