Skip to content

Instantly share code, notes, and snippets.

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 Njengah/4a2adae25c30d8bd2e810290f829e503 to your computer and use it in GitHub Desktop.
Save Njengah/4a2adae25c30d8bd2e810290f829e503 to your computer and use it in GitHub Desktop.
WooCommerce Skip Cart and Redirect to Checkout - https://njengah.com/skip-cart-and-redirect-to-checkout-woocommerce/
<?php
/**
* Skip Cart and Redirect to Checkout
* Add to functions.php of child theme
*/
add_filter('woocommerce_add_to_cart_redirect', 'njengah_skip_cart_redirect_to_checkout_page');
function njengah_skip_cart_redirect_to_checkout_page() {
global $woocommerce;
// Remove the default `Added to cart` message
wc_clear_notices();
return $woocommerce->cart->wc_get_checkout_url();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment