Skip to content
Docs
Get RestroPress

Filter

rpress_service_context_delivery_address

Updated
On this page

Filters the delivery address stored in the service context.

Runs in rpress_get_service_context() after the address is read from the branch_name cookie or, if that is absent, the delivery_address cookie. The value is a sanitized string. The second argument is the context array built so far, which already includes service_type, service_time and service_date_raw but not the later keys.

Parameters#

ParameterTypeDescription
$delivery_addressstringDelivery address or branch name read from cookies.
$contextarrayService context assembled so far.

Return value#

string. The delivery address to store in the context.

Example#

function my_default_delivery_address( $delivery_address, $context ) {
	if ( '' === $delivery_address && 'pickup' === $context['service_type'] ) {
		return __( 'Main Street Branch', 'my-plugin' );
	}
	return $delivery_address;
}
add_filter( 'rpress_service_context_delivery_address', 'my_default_delivery_address', 10, 2 );

Source#

Applied in:

  • includes/rp-core-functions.php (line 3051), in rpress_get_service_context()

See also#

Was this page helpful?