Skip to content

Instantly share code, notes, and snippets.

@renjith-ph
Last active January 16, 2019 05:37
Show Gist options
  • Save renjith-ph/0defbaf8a48d49ec61fc50add6b1b051 to your computer and use it in GitHub Desktop.
Save renjith-ph/0defbaf8a48d49ec61fc50add6b1b051 to your computer and use it in GitHub Desktop.
Snippet to redirect to checkout page after adding product to cart.
/* Snippet to redirect to checkout page after adding product to cart.
Created at : 16 Jan 2019 PluginHive Plugins : https://www.pluginhive.com/plugins/
https://gist.github.com/renjith-ph/0defbaf8a48d49ec61fc50add6b1b051
*/
function ph_change_redirect_url_after_adding_product_to_cart( $url ) {
$url = wc_get_checkout_url();
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'ph_change_redirect_url_after_adding_product_to_cart' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment