Merge pull request #13046 from thenbrent/merge_extra_data
Merge WC_Data::$extra_data in WC_Data::__construct()
This commit is contained in:
commit
1ef593ff16
|
@ -83,6 +83,9 @@ abstract class WC_Data {
|
|||
* @param int|object|array $read ID to load from the DB (optional) or already queried data.
|
||||
*/
|
||||
public function __construct( $read = 0 ) {
|
||||
|
||||
$this->data = array_merge( $this->data, $this->extra_data );
|
||||
|
||||
$this->default_data = $this->data;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,6 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
|
|||
* @param int|object|array $item ID to load from the DB, or WC_Order_Item Object
|
||||
*/
|
||||
public function __construct( $item = 0 ) {
|
||||
$this->data = array_merge( $this->data, $this->extra_data );
|
||||
parent::__construct( $item );
|
||||
|
||||
if ( $item instanceof WC_Order_Item ) {
|
||||
|
|
|
@ -38,16 +38,6 @@ class WC_Order_Refund extends WC_Abstract_Order {
|
|||
'refunded_by' => 0,
|
||||
);
|
||||
|
||||
/**
|
||||
* Extend the abstract _data properties and then read the order object.
|
||||
*
|
||||
* @param int|object|WC_Order $read Order to init.
|
||||
*/
|
||||
public function __construct( $read = 0 ) {
|
||||
$this->data = array_merge( $this->data, $this->extra_data );
|
||||
parent::__construct( $read );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get internal type (post type.)
|
||||
* @return string
|
||||
|
|
|
@ -26,15 +26,6 @@ class WC_Product_External extends WC_Product {
|
|||
'button_text' => '',
|
||||
);
|
||||
|
||||
/**
|
||||
* Merges external product data into the parent object.
|
||||
* @param int|WC_Product|object $product Product to init.
|
||||
*/
|
||||
public function __construct( $product = 0 ) {
|
||||
$this->data = array_merge( $this->data, $this->extra_data );
|
||||
parent::__construct( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get internal type.
|
||||
* @return string
|
||||
|
|
|
@ -25,15 +25,6 @@ class WC_Product_Grouped extends WC_Product {
|
|||
'children' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Merges grouped product data into the parent object.
|
||||
* @param int|WC_Product|object $product Product to init.
|
||||
*/
|
||||
public function __construct( $product = 0 ) {
|
||||
$this->data = array_merge( $this->data, $this->extra_data );
|
||||
parent::__construct( $product );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get internal type.
|
||||
* @return string
|
||||
|
|
Loading…
Reference in New Issue