Filter
rpress_get_cart_token
On this page
Filters the saved cart token of the current visitor.
Runs in RPRESS_Cart::get_token(). The token comes from the rpress_cart_token user meta for logged-in users, or the rpress_cart_token cookie for guests, and is used to validate a saved cart restore.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$token | string|false | Stored cart token, or false when a guest has no cookie. |
$user_id | int | Current user ID, 0 for guests. |
Return value#
string|false. The cart token.
Example#
function my_cart_token( $token, $user_id ) {
return $token;
}
add_filter( 'rpress_get_cart_token', 'my_cart_token', 10, 2 );
Source#
Applied in:
includes/cart/class-rpress-cart.php(line 1422), inRPRESS_Cart::get_token()
See also#
Was this page helpful?
