WC_Order_Item::offsetUnset()publicWC 1.0ReturnTypeWillChange

OffsetUnset for ArrayAccess.

Method of the class: WC_Order_Item{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Order_Item = new WC_Order_Item();
$WC_Order_Item->offsetUnset( $offset );
$offset(string) (required)
Offset.

WC_Order_Item::offsetUnset() code WC 9.3.3

public function offsetUnset( $offset ) {
	$this->maybe_read_meta_data();

	if ( 'item_meta_array' === $offset || 'item_meta' === $offset ) {
		$this->meta_data = array();
		return;
	}

	if ( array_key_exists( $offset, $this->data ) ) {
		unset( $this->data[ $offset ] );
	}

	if ( array_key_exists( $offset, $this->changes ) ) {
		unset( $this->changes[ $offset ] );
	}

	$this->delete_meta_data( $offset );
}