kisabelle
1/28/2016 - 5:46 PM

WooCommerce Memberships - check if user is member of the plan

WooCommerce Memberships - check if user is member of the plan

// Get current user ID
$user_id = get_current_user_id();

// Check if the user is member of the plan 'gold'
if ( wc_memberships_is_user_active_member( $user_id, 'gold' ) ) {
    echo 'This is a special message only for Gold members!';
} else {
    echo 'I\'m sorry, you are not a gold member. There's nothing here for you!';
}