WooCommerce::__set()publicWC 1.0

Set the value of an inaccessible or non-existing property.

Method of the class: WooCommerce{}

No Hooks.

Return

null. Nothing (null).

Usage

$WooCommerce = new WooCommerce();
$WooCommerce->__set( $key, $value );
$key(string) (required)
Property name.
$value(mixed) (required)
Property value.

WooCommerce::__set() code WC 9.4.2

public function __set( string $key, $value ) {
	if ( 'api' === $key ) {
		$this->api = $value;
	} elseif ( property_exists( $this, $key ) ) {
		// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
		trigger_error( 'Cannot access private property WooCommerce::$' . esc_html( $key ), E_USER_ERROR );
	} else {
		$this->$key = $value;
	}
}