WooCommerce – Redirect to checkout after add to cart

If you use WooCommerce, and you want your users to be redirected to checkout instead of cart or the product page, then you can do it in a really simple way.

Use this code (taken from http://stackoverflow.com/questions/15592633/woocommerce-add-to-cart-button-redirect-to-checkout):

function redirect_to_checkout() {
    return WC()->cart->get_checkout_url();
add_filter ('woocommerce_add_to_cart_redirect', 'redirect_to_checkout');

You can put it in your theme's functions.php file.


Martin Schadegg Rasch Jensen