Filter
rpress_checkout_service_fee
On this page
Filters the fee advertised on a checkout service chip.
Runs in rpress_get_checkout_service_fee_display() before core falls back to its flat delivery fee. A fee extension can return the fee for the given service even when it is not the one currently selected. Returning null defers to core; any other value is cast to float and clamped to zero or above.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$fee | null | Default null, meaning no extension has answered. |
$service_type | string | Service type of the chip, delivery or pickup. |
$current | string | Service type currently selected (from the service_type cookie), or an empty string. |
Return value#
float|null. Fee amount to display, or null to defer to core.
Example#
function my_checkout_service_fee( $fee, $service_type, $current ) {
if ( 'pickup' === $service_type ) {
return 0.0;
}
return $fee;
}
add_filter( 'rpress_checkout_service_fee', 'my_checkout_service_fee', 10, 3 );
Notes#
This only changes the text on the chip; it does not add a fee to the cart.
Source#
Applied in:
includes/rp-delivery-fee-basic.php(line 64), inrpress_get_checkout_service_fee_display()
See also#
Was this page helpful?
