Filter
rpress_show_added_to_cart_messages
On this page
Filters the 'added to cart' notice shown after a menu item is added.
Runs in rpress_show_added_to_cart_messages() when the page was loaded by an add_to_cart POST. The default is a div with the success text and a checkout link. The result is output through wp_kses() that only allows div and a elements with class and href attributes.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$alert | string | Notice markup. |
Return value#
string. The notice markup.
Example#
function my_added_to_cart_message( $alert ) {
return '<div class="rpress_added_to_cart_alert">' . esc_html__( 'Added to your order.', 'my-textdomain' ) . ' <a href="' . esc_url( rpress_get_checkout_uri() ) . '" class="rpress_alert_checkout_link">' . esc_html__( 'Checkout.', 'my-textdomain' ) . '</a></div>';
}
add_filter( 'rpress_show_added_to_cart_messages', 'my_added_to_cart_message', 10, 1 );
Notes#
Output is stripped by wp_kses to div and a tags (class, href), so other markup is removed.
Source#
Applied in:
includes/cart/template.php(line 443), inrpress_show_added_to_cart_messages()
See also#
Was this page helpful?
