Filter
cart_empty_message
On this page
Filters the message returned by the REST cart endpoints when the cart is empty.
The name is not prefixed. It is used by the cart controller's get and update handlers, which return the string as the message in the response when the cart has no items.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$message | string | Default message, 'Cart is empty'. |
Return value#
string. The message.
Example#
function my_cart_empty_message( $message ) {
return __( 'Your basket is empty.', 'my-textdomain' );
}
add_filter( 'cart_empty_message', 'my_cart_empty_message' );
Notes#
The hook name has no rpress_ or rp_ prefix, so it may collide with other plugins.
Source#
Applied in:
includes/rest-api/Controllers/Version1/class-rp-rest-cart-v1-controller.php(line 285), inRP_REST_Cart_V1_Controller::update_cart_content()includes/rest-api/Controllers/Version1/class-rp-rest-cart-v1-controller.php(line 309), inRP_REST_Cart_V1_Controller::get_cart_content()
Was this page helpful?
