woocommerce_set_cookie_enabled
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
woocommerce/includes/wc-core-functions.php 1076
if ( ! apply_filters( 'woocommerce_set_cookie_enabled', true, $name, $value, $expire, $secure ) ) {