Skip to content
Docs
Get RestroPress

Action

rpress_service_type_switched

Updated
On this page

Fires when the storefront service toggle switches the service type.

Fires in the update_modal_on_service_switch AJAX handler, after the service_type cookie has been updated and before the date and time popup is re-rendered. Fee logic can use it to react to the newly selected type.

Available since RestroPress 3.4.

Parameters#

ParameterTypeDescription
$service_typestringThe newly selected service type, or an empty string if none was posted.

Example#

function my_service_type_switched( $service_type ) {
	if ( 'delivery' !== $service_type ) {
		RPRESS()->fees->remove_fee( 'delivery_fee' );
	}
}
add_action( 'rpress_service_type_switched', 'my_service_type_switched' );

Source#

Fired from:

  • includes/class-rpress-ajax.php (line 2213), in RP_AJAX::update_modal_on_service_switch()

See also#

Was this page helpful?