Skip to content

Active subscription put "On hold" when first payment expires #194

@rvdsteege

Description

@rvdsteege

In internal support ticket https://secure.helpscout.net/conversation/2680320821/27602 an issue occurred with two attempts for a first payment for a new Restrict Content membership (probably by using the browser back button).

The 2nd attempt was successful and the subscription/membership was activated, but when the 1st attempt later expires, the subscription status was updated from "Active" to "On Hold" — resulting in the Restrict Content membership also being updated from the "Active" to "Pending" status.

It seems this is caused by a little bug in the core subscription module, as the SubscriptionStatus::ACTIVE === $subscription->get_status() check should use the !== operator:

case PaymentStatus::CANCELLED:
case PaymentStatus::EXPIRED:
// Set subscription status to 'On Hold' only if the subscription is not already active when processing the first payment.
if ( $subscription->is_first_payment( $payment ) && SubscriptionStatus::ACTIVE === $subscription->get_status() ) {
$status_update = SubscriptionStatus::ON_HOLD;
}
break;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions