woocommerce_set_cookie_options
Controls the options to be specified when setting the cookie.
Usage
add_filter( 'woocommerce_set_cookie_options', 'wp_kama_woocommerce_set_cookie_options_filter', 10, 3 );
/**
* Function for `woocommerce_set_cookie_options` filter-hook.
*
* @param array $cookie_options Cookie options.
* @param string $name Cookie name.
* @param string $value Cookie value.
*
* @return array
*/
function wp_kama_woocommerce_set_cookie_options_filter( $cookie_options, $name, $value ){
// filter...
return $cookie_options;
}
- $cookie_options(array)
- Cookie options.
- $name(string)
- Cookie name.
- $value(string)
- Cookie value.
Changelog
| Since 6.7.0 | Introduced. |
Where the hook is called
woocommerce/includes/wc-core-functions.php 948-972
$options = apply_filters( 'woocommerce_set_cookie_options', array( 'expires' => $expire, 'secure' => $secure, 'path' => COOKIEPATH ? COOKIEPATH : '/', 'domain' => COOKIE_DOMAIN, /** * Controls whether the cookie should only be accessible via the HTTP protocol, or if it should also be * accessible to Javascript. * * @see https://www.php.net/manual/en/function.setcookie.php * @since 3.3.0 * * @param bool $httponly If the cookie should only be accessible via the HTTP protocol. * @param string $name Cookie name. * @param string $value Cookie value. * @param int $expire When the cookie should expire. * @param bool $secure If the cookie should only be served over HTTPS. */ 'httponly' => apply_filters( 'woocommerce_cookie_httponly', $httponly, $name, $value, $expire, $secure ), ), $name, $value );