woocommerce_set_cookie_enabled filter-hookWC 6.3.0

Controls whether the cookie should be set via wc_setcookie().

Usage

add_filter( 'woocommerce_set_cookie_enabled', 'wp_kama_woocommerce_set_cookie_enabled_filter', 10, 5 );

/**
 * Function for `woocommerce_set_cookie_enabled` filter-hook.
 * 
 * @param bool    $set_cookie_enabled If wc_setcookie() should set the cookie.
 * @param string  $name               Cookie name.
 * @param string  $value              Cookie value.
 * @param integer $expire             When the cookie should expire.
 * @param bool    $secure             If the cookie should only be served over HTTPS.
 *
 * @return bool
 */
function wp_kama_woocommerce_set_cookie_enabled_filter( $set_cookie_enabled, $name, $value, $expire, $secure ){

	// filter...
	return $set_cookie_enabled;
}
$set_cookie_enabled(true|false)
If wc_setcookie() should set the cookie.
$name(string)
Cookie name.
$value(string)
Cookie value.
$expire(int)
When the cookie should expire.
$secure(true|false)
If the cookie should only be served over HTTPS.

Changelog

Since 6.3.0 Introduced.

Where the hook is called

wc_setcookie()
woocommerce_set_cookie_enabled
woocommerce/includes/wc-core-functions.php 1056
if ( ! apply_filters( 'woocommerce_set_cookie_enabled', true, $name, $value, $expire, $secure ) ) {

Where the hook is used in WooCommerce

Usage not found.