woocommerce_add_to_cart_redirect хук-фильтрWC 1.0

Использование

add_filter( 'woocommerce_add_to_cart_redirect', 'wp_kama_woocommerce_add_to_cart_redirect_filter', 10, 2 );

/**
 * Function for `woocommerce_add_to_cart_redirect` filter-hook.
 * 
 * @param  $wc_get_cart_url 
 * @param  $null            
 *
 * @return 
 */
function wp_kama_woocommerce_add_to_cart_redirect_filter( $wc_get_cart_url, $null ){

	// filter...
	return $wc_get_cart_url;
}
$wc_get_cart_url
-
$null
-

Где вызывается хук

WC_Frontend_Scripts::get_script_data()
woocommerce_add_to_cart_redirect
WC_Form_Handler::add_to_cart_action()
woocommerce_add_to_cart_redirect
woocommerce/includes/class-wc-frontend-scripts.php 578
'cart_url'                => apply_filters( 'woocommerce_add_to_cart_redirect', wc_get_cart_url(), null ),
woocommerce/includes/class-wc-form-handler.php 811
$url = apply_filters( 'woocommerce_add_to_cart_redirect', $url, $adding_to_cart );

Где используется хук в WooCommerce

woocommerce/src/Blocks/BlockTypes/AddToCartForm.php 32
add_filter( 'woocommerce_add_to_cart_redirect', array( $this, 'add_to_cart_redirect_filter' ), 10, 1 );