Skip to content

Instantly share code, notes, and snippets.

@renzoster
Last active July 6, 2019 12:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renzoster/a4cec1f574a86369d15e0adf002e4a1f to your computer and use it in GitHub Desktop.
Save renzoster/a4cec1f574a86369d15e0adf002e4a1f to your computer and use it in GitHub Desktop.
Woocommerce redirect user to checkout after add to cart
<?php
/**
* Redirect users after add to cart. Works with WooCommerce 3.0+
*/
function custom_add_to_cart_redirect( $url ) {
$url = WC()->cart->get_checkout_url();
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment