Ensure expiration-related modal is shown to the installed subscriptions (#49747)

Ensure expiration-related modal is shown to the installed subscriptions
This commit is contained in:
Akeda Bagus 2024-07-24 08:02:55 +07:00 committed by GitHub
parent 078aa72d50
commit d5dcf91ee2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Ensure expiration-related modal is shown to the installed Woo subscriptions

View File

@ -1336,7 +1336,11 @@ class WC_Helper {
* @return array Array of state_name => (bool) state * @return array Array of state_name => (bool) state
*/ */
public static function get_product_subscription_state( $product_id ) { public static function get_product_subscription_state( $product_id ) {
$subscription = self::_get_subscriptions_from_product_id( $product_id, true ); $product_subscriptions = wp_list_filter( self::get_installed_subscriptions(), array( 'product_id' => $product_id ) );
$subscription = ! empty( $product_subscriptions )
? array_shift( $product_subscriptions )
: array();
return array( return array(
'unregistered' => empty( $subscription ), 'unregistered' => empty( $subscription ),