Skip to content
Docs
Get RestroPress

Filter

rpress_checkout_fields

Updated
On this page

Filters the delivery address fields rendered on the checkout form.

Runs in rp_get_checkout_fields() when the checkout template builds the delivery address inputs. The value is an associative array keyed by field name (rpress_street_address, rpress_apt_suite, rpress_city, rpress_postcode). Each field is an array with the keys id, title, is_required, is_hidden, name, placeholder and value. Add, remove or edit entries to change what the checkout form shows.

Parameters#

ParameterTypeDescription
$checkout_fieldsarrayCheckout field definitions keyed by field name.
$delivery_addressarrayCustomer's saved delivery address with the keys address, flat, city and postcode.

Return value#

array. The (possibly modified) checkout field definitions.

Example#

function my_make_apt_suite_required( $checkout_fields, $delivery_address ) {
	if ( isset( $checkout_fields['rpress_apt_suite'] ) ) {
		$checkout_fields['rpress_apt_suite']['is_required'] = true;
		$checkout_fields['rpress_apt_suite']['title']       = __( 'Apt / suite', 'my-plugin' );
	}
	return $checkout_fields;
}
add_filter( 'rpress_checkout_fields', 'my_make_apt_suite_required', 10, 2 );

Notes#

Fields are only read by the checkout template; making a field required here does not add server-side validation on its own.

Source#

Applied in:

  • includes/rp-core-functions.php (line 2899), in rp_get_checkout_fields()

See also#

Was this page helpful?