WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

AbstractAddressSchema::sanitize_callback() public WC 1.0

Sanitize and format the given address object.

{} It's a method of the class: AbstractAddressSchema{}

No Hooks.

Return

Array.

Usage

$AbstractAddressSchema = new AbstractAddressSchema();
$AbstractAddressSchema->sanitize_callback( $address, $request, $param );
$address(array) (required)
Value being sanitized.
$request(\WP_REST_Request) (required)
The Request.
$param(string) (required)
The param being sanitized.

Code of AbstractAddressSchema::sanitize_callback() WC 5.6.0

public function sanitize_callback( $address, $request, $param ) {
	$address               = array_merge( array_fill_keys( array_keys( $this->get_properties() ), '' ), (array) $address );
	$address['country']    = wc_strtoupper( wc_clean( wp_unslash( $address['country'] ) ) );
	$address['first_name'] = wc_clean( wp_unslash( $address['first_name'] ) );
	$address['last_name']  = wc_clean( wp_unslash( $address['last_name'] ) );
	$address['company']    = wc_clean( wp_unslash( $address['company'] ) );
	$address['address_1']  = wc_clean( wp_unslash( $address['address_1'] ) );
	$address['address_2']  = wc_clean( wp_unslash( $address['address_2'] ) );
	$address['city']       = wc_clean( wp_unslash( $address['city'] ) );
	$address['state']      = $this->format_state( wc_clean( wp_unslash( $address['state'] ) ), $address['country'] );
	$address['postcode']   = $address['postcode'] ? wc_format_postcode( wc_clean( wp_unslash( $address['postcode'] ) ), $address['country'] ) : '';
	return $address;
}