• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WooCommerce a2z

WooCommerce a2z

WooCommerce

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WC_Order_Item::apply_changes() – Merge changes with data and clear.

You appear to be a bot. Output may be restricted

Description

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.

Usage

WC_Order_Item::apply_changes();

Parameters

Returns

void

Source

File name: woocommerce/includes/class-wc-order-item.php


Lines:

1 to 11 of 11
  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();
  }
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 10th December 2020

Primary Sidebar

Information

Function name: WC_Order_Item::apply_changes
Class ref: WC_Order_Item
Plugin ref: WooCommerce
Version: 4.8.0
Sourcefile: includes/class-wc-order-item.php
File ref: includes/class-wc-order-item.php
Deprecated?: No
API Letters: A,C,I,O,W

Footer

WooCommerce a2z
WooCommerce a2z
WooCommerce
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites