Skip to content

Instantly share code, notes, and snippets.

@jamc92
Created August 3, 2016 18:33
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 jamc92/94bcbfd8983a47110a856e83c52220ee to your computer and use it in GitHub Desktop.
Save jamc92/94bcbfd8983a47110a856e83c52220ee to your computer and use it in GitHub Desktop.
Redirect users to a custom page in WooCommerce Wordpress
<?php
/**
* Redirect users after add to cart.
*/
function my_custom_add_to_cart_redirect( $url ) {
$url = get_permalink( 1 ); // URL to redirect to (1 is the page ID here)
return $url;
}
add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment