WC_Order::get_address_prop
Gets a prop for a getter method.
Метод класса: WC_Order{}
Хуки из метода
Возвращает
Разное.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_address_prop( $prop, $address_type, $context );
- $prop(строка) (обязательный)
- Name of prop to get.
- $address_type(строка)
- Type of address; 'billing' or 'shipping'.
По умолчанию: 'billing' - $context(строка)
- What the value is for. Valid values are view and edit.
По умолчанию: 'view'
Список изменений
| С версии 3.0.0 | Введена. |
Код WC_Order::get_address_prop() WC Order::get address prop WC 10.3.5
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;
}