Skip to content

Instantly share code, notes, and snippets.

@corsonr
Last active February 4, 2019 22:03
Show Gist options
  • Save corsonr/6725310 to your computer and use it in GitHub Desktop.
Save corsonr/6725310 to your computer and use it in GitHub Desktop.
WooCommerce - Redirect add to cart to checkout page
<?php
add_filter ('woocommerce_add_to_cart_redirect', 'woo_redirect_to_checkout');
function woo_redirect_to_checkout() {
$checkout_url = WC()->cart->get_checkout_url();
return $checkout_url;
}
@imvarunkmr
Copy link

Works like a charm for Simple product, however it fails when I add product variations. Any scope of covering that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment