• Resolved stenpms72

    (@stenpms72)


    Hi,

    I noticed that when upgrading from version <8 to >8 (old versions, but still persists in 9.2.1), not all post statuses are longer available for subscriptions.

    Comparing file vendor/wp-pay/core/views/meta-box-subscription-update.php:
    version 7.0.2:

    $states = SubscriptionPostType::get_states();
    
    foreach ( $states as $subscription_status => $label ) {
    	printf(
    		'<option value="%s" %s>%s</option>',
    		esc_attr( $subscription_status ),
    		selected( $subscription_status, $post->post_status, false ),
    		esc_html( $label )
    	);
    }

    version 9.2.1:

    $states = SubscriptionPostType::get_states();
    
    $states_options = [
    	'subscr_active',
    	'subscr_cancelled',
    	'subscr_on_hold',
    ];
    
    foreach ( $states as $subscription_status => $label ) {
    	if ( ! in_array( $subscription_status, $states_options, true ) && $subscription_status !== $post->post_status ) {
    		continue;
    	}
    
    	printf(
    		'<option value="%s" %s>%s</option>',
    		esc_attr( $subscription_status ),
    		selected( $subscription_status, $post->post_status, false ),
    		esc_html( $label )
    	);
    }

    In the changelog and in this forum i can’t seem to find any information about this change. Can you tell me a little more about why this change happened?

    If we used subscr_completed before, would we use subscr_cancelled now?

    Thanks,
    Sten

Viewing 1 replies (of 1 total)
  • Plugin Author Reüel

    (@pronamic_reuel)

    Some of the statuses originate from payment statuses, but over time we’ve simplified how subscription statuses are used. The changes in the subscription update meta box reflect this.

    A subscription is created with the ‘Pending’ status (waiting for payment), and updates to ‘Active’ once the first payment has been paid successfully. Once it is active, you can either put it ‘On hold’ to temporarily pause payments or cancel the subscription. (and set it back to ‘Active’ to start payments again)

    Regarding the ‘Completed’ status: this status is still in use for subscriptions with a fixed end date (notice the end date mentioned in the ‘Phases’ meta box, instead of the infinite symbol ∞). The subscription status will be updated to ‘Completed’ on the end date. However, it doesn’t make sense to manually set the subscription to ‘Completed’: either there are still payments to be made before it will automatically update to ‘Completed’ or you’re terminating the subscription early, in which case ‘Cancelled’ better describes the new status. Therefore, this status has now been removed from the options of which you can choose when manually changing the status.

    I hope this sheds some light on the changes. Please let us know if you have any further questions.

Viewing 1 replies (of 1 total)
  • The topic ‘Subscription post statuses’ is closed to new replies.