Assuming you are using WooCommerce (but equivalent to the WC()->cart->is_empty()
check can be found for all major well-designed e-commerce plugins):
add_action('woocommerce_before_checkout_form',function(){
if (is_user_logged_in()){
$user = wp_get_current_user();
if ( bpprocn_has_incomplete_profile($user->id) ) { // check user's profile completed or not
if ( ! WC()->cart->is_empty() ) {
if (wp_redirect(bp_core_get_user_domain( $user->id ) . bp_get_profile_slug() . '/edit/group/2')) exit;
}
}
}
});
Related Posts:
- Which hook if user profile information is updated?
- Redirect logged in users if they are on a specific page
- after login that will redirect user role into a page
- Redirect users on specific post category or category page
- How to detect when a user changes their name?
- Stuck in redirect loop after using wp_login action
- Firing a function AFTER redirect
- How to get session token of current user in wp_login hook?
- BuddyPress User Profile Menu
- Redirect customer to login if not logged in when proceeding to checkout
- PHP header() gives headers already sent
- How to distinguish on hook profile_update user registering, user resetting password or user updating profile?
- Modify Notification Message When Profile Updated
- What hook do I use if I want to update a user profile field when a new user is created?
- Block Update Profile Errors
- A good hook to check authorization and redirect?
- What hook to use to redirect based on $post
- Session management issues with WordPRess 404 Error page
- Template_redirect works, but headers aren’t sent when checking via cURL
- template_redirect hooks redirect wrong URL
- profile_update hook does not fire from front-end
- frontend show edit profile with selected custom options
- Where can I find a list of WordPress hooks?
- Whats worth using add_action when we can simply use add_filter?
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Hook on trash post
- Adding onload to body
- What is the earliest possible hook for safely using `is_front_page`?
- Send data to 3rd party api with wp_remote_post on wp_login
- How to customize the WP admin default help contents
- deactivated_plugin hook: get the name of the plugin
- Is there a hook for user activation (after they click the email confirm)?
- Setcookie works on admin but not front end
- How to hook into user registration process Before user registers
- WP Admin Bar frontend issue with dashicon deregister
- A good way to add a different background image for each page?
- add_action for lost_password or modify wp-login.php?action=lostpassword
- Add my own function to existing WooCommerce hook
- @wordpress/hooks use to add actions/filters within multiple plugin
- How can I customize the upload error message in WordPress?
- WordPress hook that gets featured image from direct URL?
- homepage redirects to login page when user session expires
- Why is save_post hook being called twice despite all my efforts?
- What’s hook to use immediately after a user is authentcated [duplicate]
- Hook before posting via JSON REST API
- add_action for unknown custom post types
- How to prevent double execution of do_action statements
- When is the {$new_status}_{$post->post_type} transition hook fired?
- TinyMCE as comment editor – encoding issues
- Hook to change Logout url
- Method to find a hook
- Understanding WP
- External Authentication, session_tokens not destroyed on logout
- Get post or page id early
- Looking for a hook for post.php
- Executing Arbitrary Code at a Specific URL without Creating a Post or Page?
- Update a costume wp_usermeta key back to 0 every 24hours (time can be specified as needed)
- customize_controls_enqueue_scripts doesn’t fire from within my plugin
- Save User Meta Email Address in Lowercase
- When are wp redirect methods safe to hook?
- WooCommerce single product page quantity description [closed]
- How to cancel the trash action inside wp_trash_post
- wp_insert_post_data hook should be called before updating db but isn’t
- Force HTTPS 301 redirect with hook
- load-* hook for dashboard
- What conditions must be met in order to upload .zip file to a multisite WordPress installation?
- How to hook code in ?
- wp_enqueue_script before wp_head
- Is it possible to add the_content filter upon login?
- Use an array of page template slugs and $hook
- wp_logout hook never triggered
- add short description under price
- How do I use pre_option_{option_name} correctly?
- WordPress media library allow uploading fake file
- How to add custom tab page in backend?
- Add html code in admin page
- Hooking dynamic/variable named hook in all cases
- What hook to add at start of WordPress load
- Knowing if a post is sticky in the ‘save_post’ action. Where do I have to hook?
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- Is it likely that do_action will have unexpected results?
- How to export category name and category link in wordpress json
- Error later wordpress 5.3.2 update. Please help
- How to abort a save operation with a WordPress hook?
- is_page not triggering
- admin_post_(action) hook create console log error
- Check if front page within function passed to action
- Identify if the_post hook is being called from the admin post list
- How to resolve 500 error in post listing page?
- Object oriented programming, add_action in constructor not firing
- Get new (not old) post inside transition_post_status hook
- How to Show Different Information to your authors/contributers
- Removing action from template class
- Remove “enqueued” script from array
- Function is Missing an Action Hook
- How to access variables in the function where apply_filters() is called?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- How can I get the ID before after_setup_theme?
- Hook on opening a media/document