X

Redirect ‘cart’ page and skip to checkout

In most cases, users are only shopping for a few items or looking for a quick buy when they visit your store. This snippet will let the user skip the cart page and go right to the checkout page. Often, the checkout page has everything they need to see, so this snippet can help avoid abandoned carts caused by an unneeded cart page.

add_filter( 'add_to_cart_redirect', 'redirect_to_checkout' );
 
function redirect_to_checkout() {
 global $woocommerce;
 $checkout_url = $woocommerce->cart->get_checkout_url();
 
 return $checkout_url;
}

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!