WordPress filter hook

woocommerce_cookie

Defined by WooCommerce and fired by 14 plugins in total, running on 7M+ sites between them.

“Filter the cookie name.”

How to use woocommerce_cookie

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_cookie', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

14 plugins that fire woocommerce_cookie

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/class-wc-session-handler.php:83
  2. AppPresser icon AppPresser900+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) modules/commerce/includes/class-appcommerce-session.php:76
  3. Bolt Checkout for WooCommerce icon Bolt Checkout for WooCommerce100+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/classes/class-bolt-auth-redirect.php:417
  4. Msg91 for WooCommerce icon Msg91 for WooCommerce100+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/services/VoiceBotAPIService.php:188
  5. Printcart Store icon Printcart Store80+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . ( defined( 'COOKIEHASH' ) ? COOKIEHASH : '' ) ) includes/class-api.php:98
  6. Apex Digital Toolbox icon Apex Digital Toolbox40+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) hooks/hook_woocommerce.php:568
  7. CartRevival icon CartRevival40+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/class-rest.php:868
  8. Knowband Mobile App Builder icon Knowband Mobile App Builder10+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) api/2.0/wmab-category.php:217
  9. Mobile App for WooCommerce: ShopApper Mobile App Builder Service for WooCommerce icon Mobile App for WooCommerce: ShopApper Mobile App Builder Service for WooCommerce10+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/Helper.php:55
  10. Rooster One icon Rooster One10+ installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/carts/class-aieo-carts-frontend.php:538
  11. BYLTCommerce Toolkit icon BYLTCommerce ToolkitFewer than 10 installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) modules/login-as-customer/class-login-as-customer.php:375
  12. Admin Powerups for WooCommerce icon Admin Powerups for WooCommerceFewer than 10 installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) src/Modules/SwitchUser/Module.php:540
  13. Trackdolphin icon TrackdolphinFewer than 10 installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/class-td-url-identifiers.php:185
  14. Carticy SiteVitals icon Carticy SiteVitalsFewer than 10 installs apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ) includes/class-carticy-sitevitals-guest-cart.php:340

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.