add_to_cart_redirect

The WordPress Core add to cart redirect hook.

Description

add_filter( 'add_to_cart_redirect', (string) $wcpgsk_add_to_checkout_redirect, (int) $int ); 

Parameters (2)

0. $wcpgsk_add_to_checkout_redirect (string) => 'wcpgsk_add_to_checkout_redirect'
The wcpgsk add to checkout redirect.
1. $int (int) => 99
The int.

Usage

To run the hook, copy the example below.
  1. $wcpgsk_add_to_checkout_redirect = apply_filters( 'add_to_cart_redirect', $wcpgsk_add_to_checkout_redirect, $int ); 
  2.  
  3. if ( !empty( $wcpgsk_add_to_checkout_redirect ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the add_to_cart_redirect callback 
  2. function filter_add_to_cart_redirect( $wcpgsk_add_to_checkout_redirect, $int ) { 
  3. // make filter magic happen here... 
  4. return $wcpgsk_add_to_checkout_redirect
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'add_to_cart_redirect', 'filter_add_to_cart_redirect', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'add_to_cart_redirect', 'filter_add_to_cart_redirect', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wcpgsk-af.php  
  1. add_filter('add_to_cart_redirect', 'wcpgsk_add_to_checkout_redirect', 99); //late execution, to assure that we overwrite WooCommerce Setting