Skip to content
Docs
Get RestroPress

Filter

rpress_fee_extension_non_zero

Updated
On this page

Filters whether a fee extension has a non-zero fee configured.

Runs right after rpress_has_fee_extension while building the checkout service chip sublabel. If this and rpress_has_fee_extension are both true, the sublabel shows nothing instead of 'Free' for delivery (when no fee applies yet) and pickup.

Parameters#

ParameterTypeDescription
$fee_extension_non_zeroboolWhether a detected extension has a fee above zero.
$service_typestringService type of the chip.

Return value#

bool. True if a fee is configured.

Example#

function my_fee_extension_non_zero( $fee_extension_non_zero, $service_type ) {
	if ( 'delivery' === $service_type && (float) get_option( 'my_plugin_delivery_fee', 0 ) > 0 ) {
		return true;
	}
	return $fee_extension_non_zero;
}
add_filter( 'rpress_fee_extension_non_zero', 'my_fee_extension_non_zero', 10, 2 );

Source#

Applied in:

  • includes/rp-delivery-fee-basic.php (line 144), in rpress_get_checkout_service_fee_sublabel()

See also#

Was this page helpful?