Skip to content

Instantly share code, notes, and snippets.

@bernattorras
Created July 5, 2018 17:08
Show Gist options
  • Save bernattorras/83c746e5fe230c35bb438346dcd5d0cc to your computer and use it in GitHub Desktop.
Save bernattorras/83c746e5fe230c35bb438346dcd5d0cc to your computer and use it in GitHub Desktop.
Function to redirect the customer to a the checkout page (or a custom page) after adding a product to the cart
<?php
/**
* Function to redirect the customer to a the checkout page (or a custom page) after adding a product to the cart
**/
add_filter ('woocommerce_add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
return wc_get_checkout_url();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment