Skip to content
Docs
Get RestroPress

Filter

rpress_flat_delivery_fee_amount

Updated
On this page

Filters the configured flat delivery fee amount.

Runs in rpress_get_flat_delivery_fee() on the value of the flat_delivery_fee option (default 0). The result is cast to float, so return a number or numeric string.

Parameters#

ParameterTypeDescription
$amountmixedValue of the flat_delivery_fee option.

Return value#

float|string|int. The flat delivery fee; cast to float by the caller.

Example#

function my_flat_fee_for_weekends( $amount ) {
	if ( (int) wp_date( 'N' ) >= 6 ) {
		return (float) $amount + 1.5;
	}
	return $amount;
}
add_filter( 'rpress_flat_delivery_fee_amount', 'my_flat_fee_for_weekends' );

Source#

Applied in:

  • includes/rp-delivery-fee-basic.php (line 38), in rpress_get_flat_delivery_fee()

See also#

Was this page helpful?