WC_Customer::set_address_prop()protectedWC 3.0.0

Sets a prop for a setter method.

Method of the class: WC_Customer{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->set_address_prop( $prop, $address_type, $value );
$prop(string) (required)
Name of prop to set.
$address_type(string) (required)
Type of address; 'billing' or 'shipping'.
$value(mixed) (required)
Value of the prop.

Changelog

Since 3.0.0 Introduced.

WC_Customer::set_address_prop() code WC 8.7.0

protected function set_address_prop( $prop, $address_type, $value ) {
	if ( array_key_exists( $prop, $this->data[ $address_type ] ) ) {
		if ( true === $this->object_read ) {
			if ( $value !== $this->data[ $address_type ][ $prop ] || ( isset( $this->changes[ $address_type ] ) && array_key_exists( $prop, $this->changes[ $address_type ] ) ) ) {
				$this->changes[ $address_type ][ $prop ] = $value;
			}
		} else {
			$this->data[ $address_type ][ $prop ] = $value;
		}
	}
}