Need advice on website

Building a website on wordpress.org and have a few questions/problems if anyone would like to help out.

So first issue: On my pricing page, I have packages that people can select by pressing the "select plan" button.
If someone isn't logged into the site but presses the select plan button (or the sign in button in the header), I want a Google sign-up/log-in prompt to pop up so the user can sign in. Once signed in, it will take them to the next page. Working with ChatGPT (taking instructions from it), I tried doing this with Nextend and adding Conditional Logic for the Login Prompt using the snippet plugin.

add_action('template_redirect', 'redirect_to_google_login');

function redirect_to_google_login() {

// Change 'client-information' to your client information form page slug

if (!is_user_logged_in() && is_page('client-information')) {

error_log('Redirecting to Google Login'); // Debugging line

wp_redirect('http://localhost/mywordpress/wp-login.php?loginSocial=google');

exit;

} else {

error_log('User is logged in or not on the correct page'); // Debugging line

}

}

this is the code I used but it didn't work.

The other question I have is about woocommerce. I plan on using that for the checkout page and account home page where users can see analytics and selected plan/order history but just wondering if anyone has any tips on using it.

Any help is appreciated, thank you.

2 Comments
  1. Just use a membership plugin. If you want to do it right the first turn around. Use a plugin like MemberPress to restrict content pro.

  2. Why not just use the options that are built into to WC?

    1. Enable “Redirect to the cart page after successful addition” in Woocommerce > Products”
    2. Untick “Enable guest checkout (recommended)” in Woocommerce > Settings > Accounts & Privacy

    That will achieve essentially the same UX.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer