Skip to content

Instantly share code, notes, and snippets.

@junixdev
Last active April 9, 2018 13:38
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 junixdev/1c0dbd369653b02cd0f1ddc4da6b755e to your computer and use it in GitHub Desktop.
Save junixdev/1c0dbd369653b02cd0f1ddc4da6b755e to your computer and use it in GitHub Desktop.
Skip the Cart page entirely and proceed to Checkout page when adding a product to the cart session
<?php
add_filter ('woocommerce_add_to_cart_redirect', 'junix_redirect_to_checkout');
function junix_redirect_to_checkout() {
$checkout_url = WC()->cart->get_checkout_url();
return $checkout_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment