woocommerce_set_cookie_options хук-фильтрWC 6.7.0

Controls the options to be specified when setting the cookie.

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

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(массив)
Cookie options.
$name(строка)
Cookie name.
$value(строка)
Cookie value.

Список изменений

С версии 6.7.0 Введена.

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

wc_setcookie()
woocommerce_set_cookie_options
woocommerce/includes/wc-core-functions.php 1071-1095
$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
);

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

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