Skip to content

Instantly share code, notes, and snippets.

@woogist
Created July 27, 2015 08:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogist/fc8dded0c354bdd8b8b4 to your computer and use it in GitHub Desktop.
Save woogist/fc8dded0c354bdd8b8b4 to your computer and use it in GitHub Desktop.
// Automatically grant membership at registration
function sv_add_membership_at_registration( $user_id ) {
$args = array(
// Enter the ID (post ID) of the plan to grant at registration
'plan_id' => 253,
'user_id' => $user_id,
);
wc_memberships_create_user_membership( $args );
}
add_action( 'user_register', 'sv_add_membership_at_registration', 15 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment