Fix subscription status and action items for free (lifetime) subs (#51628)

* Fix subscription status and action items for free (lifetime) subs

* Changelog

* Lint
This commit is contained in:
Boro Sitnikovski 2024-09-30 15:14:39 +02:00 committed by GitHub
parent 52d0b8c17d
commit fae492632a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 5 deletions

View File

@ -355,9 +355,16 @@ export function subscriptionStatus(
);
}
return subscription.autorenew
? __( 'Active', 'woocommerce' )
: __( 'Cancelled', 'woocommerce' );
let status;
if ( subscription.lifetime ) {
status = __( 'Lifetime', 'woocommerce' );
} else if ( subscription.autorenew ) {
status = __( 'Active', 'woocommerce' );
} else {
status = __( 'Cancelled', 'woocommerce' );
}
return status;
}
return {
display: getStatus(),
@ -377,7 +384,7 @@ export function actions( subscription: Subscription ): TableRow {
let actionButton = null;
if ( subscription.product_key === '' ) {
actionButton = <SubscribeButton subscription={ subscription } />;
} else if ( subscription.expired ) {
} else if ( subscription.expired && ! subscription.lifetime ) {
actionButton = <RenewButton subscription={ subscription } />;
} else if (
subscription.local.installed === false &&
@ -391,7 +398,7 @@ export function actions( subscription: Subscription ): TableRow {
actionButton = (
<ConnectButton subscription={ subscription } variant="link" />
);
} else if ( ! subscription.autorenew ) {
} else if ( ! subscription.autorenew && ! subscription.lifetime ) {
actionButton = <AutoRenewButton subscription={ subscription } />;
}

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix subscription status and action items for free (lifetime) subscriptions