WC_Order::get_address_prop()
Gets a prop for a getter method.
Method of the class: WC_Order{}
Hooks from the method
Return
Mixed
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_address_prop( $prop, $address_type, $context );
- $prop(string) (required)
- Name of prop to get.
- $address_type(string)
- Type of address; 'billing' or 'shipping'.
Default: 'billing' - $context(string)
- What the value is for. Valid values are view and edit.
Default: 'view'
Changelog
Since 3.0.0 | Introduced. |
WC_Order::get_address_prop() WC Order::get address prop code WC 9.6.1
protected function get_address_prop( $prop, $address_type = 'billing', $context = 'view' ) { $value = null; if ( array_key_exists( $prop, $this->data[ $address_type ] ) ) { $value = isset( $this->changes[ $address_type ][ $prop ] ) ? $this->changes[ $address_type ][ $prop ] : $this->data[ $address_type ][ $prop ]; if ( 'view' === $context ) { /** * Filter: 'woocommerce_order_get_[billing|shipping]_[prop]' * * Allow developers to change the returned value for any order address property. * * @since 3.6.0 * @param string $value The address property value. * @param WC_Order $order The order object being read. */ $value = apply_filters( $this->get_hook_prefix() . $address_type . '_' . $prop, $value, $this ); } } return $value; }