Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created July 20, 2016 11:30
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save claudiosanches/6689ea2db57ec8de0847d5a6bb1349cd to your computer and use it in GitHub Desktop.
WooCommerce - Redirect to checkout after add product to the cart
<?php
/**
* Add to cart redirect to checkout.
*
* @param string $url
* @return string
*/
function my_wc_add_to_cart_redirect_to_checkout( $url ) {
return wc_get_checkout_url();
}
add_filter( 'woocommerce_add_to_cart_redirect', 'my_wc_add_to_cart_redirect_to_checkout' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment