Advertisement
shuvocse

WooCommerce - Skip cart page redirecting to checkout page

Nov 21st, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. // Function that skip cart redirecting to checkout
  2. function skip_cart_page_redirection_to_checkout() {
  3.  
  4.     // If is cart page, redirect checkout.
  5.     if( is_cart() )
  6.         wp_redirect( WC()->cart->get_checkout_url() );
  7. }
  8. add_action('template_redirect', 'skip_cart_page_redirection_to_checkout');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement