WC_Order_Item::offsetSet()publicWC 1.0

[\ReturnTypeWillChange]

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

No Hooks.

Return

null. Nothing.

Usage

$WC_Order_Item = new WC_Order_Item();
$WC_Order_Item->offsetSet( $offset, $value );
$offset (required)
-
$value (required)
-

Code of WC_Order_Item::offsetSet() WC 6.5.1

public function offsetSet( $offset, $value ) {
	if ( 'item_meta_array' === $offset ) {
		foreach ( $value as $meta_id => $meta ) {
			$this->update_meta_data( $meta->key, $meta->value, $meta_id );
		}
		return;
	}

	if ( array_key_exists( $offset, $this->data ) ) {
		$setter = "set_$offset";
		if ( is_callable( array( $this, $setter ) ) ) {
			$this->$setter( $value );
		}
		return;
	}

	$this->update_meta_data( $offset, $value );
}