WordPress filter hook
wc_session_use_secure_cookie
Fired by 11 WordPress plugins, running on 7.2M+ sites between them.
“Filter whether to use a secure cookie.”
How to use wc_session_use_secure_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:
add_filter( 'wc_session_use_secure_cookie', function( $site_is_https ) {
// Change $site_is_https here.
return $site_is_https;
}, 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.
11 plugins that fire wc_session_use_secure_cookie
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
WooCommerce7+ million installs
apply_filters( 'wc_session_use_secure_cookie', wc_site_is_https() && is_ssl() )includes/class-wc-session-handler.php:383 -
WPML Multilingual & Multicurrency for WooCommerce100,000+ installs
apply_filters( 'wc_session_use_secure_cookie', false )classes/urls/class-wcml-xdomain-data.php:75 -
FOX50,000+ installs
apply_filters( 'wc_session_use_secure_cookie', ( false !== strstr( get_option( 'home' ), 'https:' ) ) && is_ssl() )classes/woocs_session.php:79 -
Products Per Page for WooCommerce10,000+ installs
apply_filters( 'wc_session_use_secure_cookie', false )includes/class-wppp-front-end.php:206 -
MyWorks Sync for WooCommerce & QuickBooks Online5,000+ installs
apply_filters( 'wc_session_use_secure_cookie', wc_site_is_https() && is_ssl() )includes/lib/session-handler.php:83 -
MyWorks Sync for WooCommerce & Xero1,000+ installs
apply_filters( 'wc_session_use_secure_cookie', wc_site_is_https() && is_ssl() )includes/class-functions/class-session-handler.php:85 -
SMS Abandoned Cart Recovery400+ installs
apply_filters( 'wc_session_use_secure_cookie', is_ssl() )classes/class-cartboss-utils.php:487 -
TABLEiT20+ installs
apply_filters( 'wc_session_use_secure_cookie', wc_site_is_https() && is_ssl() )class-iwptp-session-handler.php:150 -
Knowband Mobile App Builder10+ installs
apply_filters( 'wc_session_use_secure_cookie', false )api/2.0/wmab-category.php:226 -
WPHEKA Request For Quote for WooCommerce10+ installs
apply_filters( 'wc_session_use_secure_cookie', wc_site_is_https() && is_ssl() )includes/class-wpheka-rfq-session-handler.php:148 -
PureClarityFewer than 10 installs
apply_filters( 'wc_session_use_secure_cookie', wc_site_is_https() && is_ssl() )includes/class-pureclarity-session.php:147
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.