kingtommy dot com

MeetCritique subscription lifecycle

Client project · Excerpts from the live MeetCritique code

WooCommerce Subscriptions is the billing source of truth. A few hooks mirror it into the member's paid-through date, so the rest of the site only asks whether someone is a member.

A subscription moving from pending to active is the purchase. It sets the paid-through date to the next payment date plus a two day buffer, so a late webhook or a payment retry does not lock a paying member out. Cancelled or expired starts a 30-day grace window. On-hold needs no action: the date runs out if payment never recovers.

A successful renewal advances the next payment date without changing the subscription's status, so the status hook never fires for it. A separate hook, woocommerce_subscription_renewal_payment_complete, re-syncs the date.

Status changes functions.php:3555-3558, 3562-3567
add_action( 'woocommerce_subscription_status_updated', 'mc_fullsend_subscription_status_updated', 10, 3 );
function mc_fullsend_subscription_status_updated( $subscription, $new_status, $old_status ) {
    if ( ! is_a( $subscription, 'WC_Subscription' ) ) return;
    if ( mc_fullsend_subscription_months( $subscription ) <= 0 ) return; // not FullSend
// …
if ( 'active' === $new_status ) {
    // Initial activation (pending -> active) is the purchase; anything
    // else (on-hold recovery, reactivation) is a sync.
    $type     = ( 'pending' === $old_status ) ? 'purchase' : 'sync';
    $order_id = $subscription->get_parent_id() ? (int) $subscription->get_parent_id() : null;
    mc_fullsend_sync_subscription_expiry( $subscription, $type, $order_id, $note );
Renewals functions.php:3598-3603
// Successful renewal payments advance next_payment WITHOUT a status change,
// so status_updated never fires. This hook re-syncs the paid-through date.
add_action( 'woocommerce_subscription_renewal_payment_complete', 'mc_fullsend_subscription_renewed', 10, 2 );
function mc_fullsend_subscription_renewed( $subscription, $last_order ) {
    if ( ! is_a( $subscription, 'WC_Subscription' ) ) return;
    if ( mc_fullsend_subscription_months( $subscription ) <= 0 ) return;

All demos