WC_Customer::get_address_prop
Gets a prop for a getter method.
Method of the class: WC_Customer{}
Hooks from the method
Returns
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_Customer::get_address_prop() WC Customer::get address prop code WC 10.7.0
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_customer_get_[billing|shipping]_[prop]'
*
* Allow developers to change the returned value for any customer address property.
*
* @since 3.6.0
* @param string $value The address property value.
* @param WC_Customer $customer The customer object being read.
*/
$value = apply_filters( $this->get_hook_prefix() . $address_type . '_' . $prop, $value, $this );
}
}
return $value;
}