Find answers, ask questions, and connect with our
community around the world.

Forums Forums Web Design WordPress Need help with woocommerce code using the membership hook (function.php).

  • Need help with woocommerce code using the membership hook (function.php).

    updated 7 months, 1 week ago 0 Member · 1 Post
  • Deborah

    October 26, 2019 at 1:32 pm

    Wanting to use a redirect function so that depending if the member has an active plan, they should be directed to the member page. If not, then you proceed to the homepage. This code is half working. When I have a non-active member who did not purchase a plan, they are sent to the homepage, however, when a member who has purchase the plan, they’re also being sent to the home page and not the member page. How can I fix this? CODE: add_filter(‘woocommerce_login_redirect’, ‘wc_login_redirect’); function wc_login_redirect( $redirect_to ) { // 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, ‘wasb’ ) ) { $redirect_to = ‘’; return $redirect_to; } else { $redirect_to = ‘’; return $redirect_to; } } – by hq overview lalamanicer – –

Reply to: Deborah
Your information:

Original Post
0 of 0 posts June 2018