WC_Order_Item_Tax_Data_Store::read()publicWC 3.0.0

Read/populate data properties specific to this order item.

Method of the class: WC_Order_Item_Tax_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Order_Item_Tax_Data_Store = new WC_Order_Item_Tax_Data_Store();
$WC_Order_Item_Tax_Data_Store->read( $item );
$item(WC_Order_Item_Tax) (required) (passed by reference — &)
Tax order item object.

Changelog

Since 3.0.0 Introduced.

WC_Order_Item_Tax_Data_Store::read() code WC 9.4.2

public function read( &$item ) {
	parent::read( $item );
	$id = $item->get_id();
	$item->set_props(
		array(
			'rate_id'            => get_metadata( 'order_item', $id, 'rate_id', true ),
			'label'              => get_metadata( 'order_item', $id, 'label', true ),
			'compound'           => get_metadata( 'order_item', $id, 'compound', true ),
			'tax_total'          => get_metadata( 'order_item', $id, 'tax_amount', true ),
			'shipping_tax_total' => get_metadata( 'order_item', $id, 'shipping_tax_amount', true ),
			'rate_percent'       => get_metadata( 'order_item', $id, 'rate_percent', true ),
		)
	);
	$item->set_object_read( true );
}