kingtommy dot com

MeetCritique FullSend payment

Client project · Excerpts from the live MeetCritique code

FullSend is MeetCritique's paid membership, sold through WooCommerce. When an order is paid, the site grants or extends access exactly once.

A product opts in with a fullsend_months meta value: 1 for monthly, 12 for annual. The grant runs on both woocommerce_payment_complete and woocommerce_order_status_completed, because different gateways and manual completion fire different ones.

Running on two hooks makes a double grant possible, so the handler is idempotent. It writes an order-level flag with add_post_meta( ..., $unique = true ), which returns false if the flag already exists, and returns early when it does.

Subscription orders are skipped here. wcs_order_contains_subscription() comes from WooCommerce Subscriptions, and those orders belong to the subscription hooks in the lifecycle entry.

Hooks and guards functions.php:3466-3468, 3477-3478
add_action( 'woocommerce_payment_complete',       'mc_fullsend_grant_on_purchase', 10, 1 );
add_action( 'woocommerce_order_status_completed', 'mc_fullsend_grant_on_purchase', 10, 1 );
function mc_fullsend_grant_on_purchase( $order_id ) {
// …
if ( function_exists( 'wcs_order_contains_subscription' ) &&
     wcs_order_contains_subscription( $order, 'any' ) ) return;
Grant once functions.php:3496-3497, 3499-3506
$inserted = add_post_meta( $order_id, '_fullsend_membership_added', true, true );
if ( false === $inserted ) return;
// …
    $type = FullSend::is_paid( $user_id ) ? 'renewal' : 'purchase';
    FullSend::grant( $user_id, array(
        'months'   => $total_months,
        'order_id' => $order_id,
        'type'     => $type,
        'note'     => 'WooCommerce order #' . $order_id,
    ) );
}

All demos