Skip to main content

benecaster_donation_confirmation_message

Filter Free

Fires during shortcode rendering when the (initially hidden) confirmation screen is built. The $amount and $currency are the values at render time — the confirmation screen is pre-rendered at page load and revealed client-side after payment.

Return a string. Cast with (string).

$amount is 0.0 here, not the donation amount. This filter runs at config-fetch time, before any donation exists — the parameter is present for signature stability. A callback interpolating it into a thank-you message will publish “Thank you for your $0.00” to every donor.

When a real amount is available elsewhere in this subsystem it is in major units (dollars, not cents) — never divide by 100.

$show_id is 0 when there is no show context.

Parameters

Name Type Default Description
$message_html string — Rendered HTML of the configurable thank-you message
$show_id int — ID of the show
$amount float — Donation amount in major units at render time
$currency string — ISO 4217 currency code, uppercase (e.g. USD)

Returns: string

Example

add_filter( 'benecaster_donation_confirmation_message', function( $message_html, $show_id, $amount, $currency ) {
    // Personalize the thank-you with the donor's name if logged in.
    if ( is_user_logged_in() ) {
        $name         = wp_get_current_user()->display_name;
        $message_html = str_replace( '<p>', '<p>Hi ' . esc_html( $name ) . ', ', $message_html );
    }
    return $message_html;
}, 10, 4 );

Need this built rather than just documented? See our services →