WooCommerce::__set
Set the value of an inaccessible or non-existing property.
Method of the class: WooCommerce{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WooCommerce = new WooCommerce(); $WooCommerce->__set( $key, $value );
- $key(string) (required)
- Property name.
- $value(mixed) (required)
- Property value.
WooCommerce::__set() WooCommerce:: set code WC 10.7.0
public function __set( string $key, $value ) {
if ( 'api' === $key ) {
$this->api = $value;
} elseif ( property_exists( $this, $key ) ) {
throw new Exception( 'Cannot access private property ' . __CLASS__ . '::$' . esc_html( $key ) );
} else {
$this->$key = $value;
}
}