public function __construct($item = 0)
{
$this->data = array_merge($this->data, $this->extra_data);
parent::__construct($item);
if ($item instanceof WC_Order_Item) {
$this->set_id($item->get_id());
} elseif (is_numeric($item) && $item > 0) {
$this->set_id($item);
} else {
$this->set_object_read(true);
}
$type = 'line_item' === $this->get_type() ? 'product' : $this->get_type();
$this->data_store = WC_Data_Store::load('order-item-' . $type);
if ($this->get_id() > 0) {
$this->data_store->read($this);
}
}