1

I'm trying to redirect customers, who are not logged in, when they push the "proceed to checkout button" on my cart page but nothing happens.

Here's my code:

function custom_redirect_checkout(){
if ( !is_user_logged_in() ){

  wp_redirect( 'https://www.domain.co/login/', 301 );

  exit;
  }
}

add_filter( 'woocommerce_proceed_to_checkout', 'custom_redirect_checkout' );
0

I think woocommerce_proceed_to_checkout is an action, not a filter.

See http://hookr.io/actions/woocommerce_proceed_to_checkout/.

For the difference between actions and filters check out this question: Difference Between Filter and Action Hooks?

  • add_action is an alias for add_filter, so this does not matter. – janh Jan 24 '18 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.