Skip to content

Instantly share code, notes, and snippets.

@marcosnakamine
Forked from claudiosanches/functions.php
Created March 15, 2017 14:19
Show Gist options
  • Save marcosnakamine/6197d370f12809550e4d9fac3d10740a to your computer and use it in GitHub Desktop.
Save marcosnakamine/6197d370f12809550e4d9fac3d10740a 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