WordPress at Your Fingertips
function is not described

WC_Order_Item::apply_changes() public WC 3.2.0

Merge changes with data and clear. Overrides WC_Data::apply_changes. array_replace_recursive does not work well for order items because it merges taxes instead of replacing them.

{} 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->apply_changes();

Changelog

Since 3.2.0 Introduced.

Code of WC_Order_Item::apply_changes() WC 5.7.0

public function apply_changes() {
	if ( function_exists( 'array_replace' ) ) {
		$this->data = array_replace( $this->data, $this->changes ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.array_replaceFound
	} else { // PHP 5.2 compatibility.
		foreach ( $this->changes as $key => $change ) {
			$this->data[ $key ] = $change;
		}
	}
	$this->changes = array();
}