Skip to main content

benecaster_donation_suggested_amounts

Filter Free

Fires during shortcode rendering before the suggested-amount buttons are output. Suggested amounts render as pre-set clickable buttons; a free-text custom amount input renders alongside them when “Allow custom amount” is enabled in Show Editor → Listener Support. This filter controls the button set only — the custom amount input visibility is governed by the show setting, not this filter. Return an empty array to suppress all buttons; the custom amount input remains if the show setting is on.

Amounts are ints in MINOR units (cents), not floats in dollars. Returning [ 2.00, 5.00 ] here does not offer $2 and $5 buttons — it offers two cents and five cents, and Stripe refuses them.

This filter owns the buttons, and it is the only thing that does. The minimum_custom_amount floor never applies to a show’s suggested amounts — Benecaster matches the suggested list first, deliberately — so if you want a suggested amount gone, remove it here. No minimum filter will do it for you.

Parameters

Name Type Default Description
$amounts int[] — Array of suggested amounts in MINOR units (e.g. [300, 500, 1000, 2500] for $3/$5/$10/$25 in USD). Minor units are not always hundredths — read the currency rather than assuming cents.
$show_id int — ID of the show

Returns: int[]

Example

add_filter( 'benecaster_donation_suggested_amounts', function( $amounts, $show_id ) {
    // Use a custom set of amounts for a specific show.
    // MINOR units -- 200 is $2.00 in USD, not two dollars-as-a-float.
    if ( (int) $show_id === 42 ) {
        return [ 200, 500, 1500, 5000 ];
    }
    return $amounts;
}, 10, 2 );

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