WC_Data::set_prop( string $prop, mixed $value )

Sets a prop for a setter method.


Description Description

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


Parameters Parameters

$prop

(Required) Name of prop to set.

$value

(Required) Value of the prop.


Top ↑

Source Source

File: includes/abstracts/abstract-wc-data.php

	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;
			}
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.