woocommerce_restored_session_data

FILTER woocommerce\includes\class-wc-session-handler.php (ligne 270) github
Filters the session data when restoring from storage during initialization. This filter allows you to: 1. Modify the session data before it's loaded, including adding or removing specific session data entries 2. Clear the entire session by returning an empty array Note: If the filtered data is empty, the session will be destroyed and the guest's session cookie will be removed. This can be useful for high-traffic sites that prioritize page caching over maintaining all session data.

Paramètres

Entrée :
$session_data
Sortie :
@param array $session_data The session data loaded from storage.
@return array Modified session data to be used for initialization.

Utilisation

// Modifier la valeur avec le filtre 'woocommerce_restored_session_data'
add_filter('woocommerce_restored_session_data', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($session_data) {
    // Modifier la valeur
    return $session_data;
}

Actualités

Chargement des actualités...