WC_Order::set_address_prop
Sets a prop for a setter method.
Method of the class: WC_Order{}
No Hooks.
Returns
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_Order::set_address_prop() WC Order::set address prop code WC 10.4.3
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;
}
}
}