WordPress at Your Fingertips
function is not described

WC_Data::set_prop() protected WC 3.0.0

Sets a prop for a setter method.

This stores changes in a special array so we can track what needs saving the the DB later.

{} It's a method of the class: WC_Data{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->set_prop( $prop, $value );
$prop(string) (required)
Name of prop to set.
$value(mixed) (required)
Value of the prop.

Changelog

Since 3.0.0 Introduced.

Code of WC_Data::set_prop() WC 5.8.0

protected function set_prop( $prop, $value ) {
	if ( array_key_exists( $prop, $this->data ) ) {
		if ( true === $this->object_read ) {
			if ( $value !== $this->data[ $prop ] || array_key_exists( $prop, $this->changes ) ) {
				$this->changes[ $prop ] = $value;
			}
		} else {
			$this->data[ $prop ] = $value;
		}
	}
}