WC_Data::get_prop
Gets a prop for a getter method.
Gets the value from either current pending changes, or the data itself. Context controls what happens to the value before it's returned.
Method of the class: WC_Data{}
Hooks from the method
Returns
Mixed
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_prop( $prop, $context );
- $prop(string) (required)
- Name of prop to get.
- $context(string)
- What the value is for. Valid values are view and edit.
Default: 'view'
Changelog
Since 3.0.0 | Introduced. |
WC_Data::get_prop() WC Data::get prop code WC 9.9.5
protected function get_prop( $prop, $context = 'view' ) { $value = null; if ( array_key_exists( $prop, $this->data ) ) { $value = array_key_exists( $prop, $this->changes ) ? $this->changes[ $prop ] : $this->data[ $prop ]; if ( 'view' === $context ) { $value = apply_filters( $this->get_hook_prefix() . $prop, $value, $this ); } } return $value; }