WordPress at Your Fingertips
function is not described

WC_Order_Item_Shipping_Data_Store::read() public WC 3.0.0

Read/populate data properties specific to this order item.

{} It's a method of the class: WC_Order_Item_Shipping_Data_Store{}

No Hooks.

Return

null. Nothing.

Usage

$WC_Order_Item_Shipping_Data_Store = new WC_Order_Item_Shipping_Data_Store();
$WC_Order_Item_Shipping_Data_Store->read( $item );
$item(WC_Order_Item_Shipping) (required) (passed by reference — &)
Item to read to.

Changelog

Since 3.0.0 Introduced.

Code of WC_Order_Item_Shipping_Data_Store::read() WC 5.8.0

public function read( &$item ) {
	parent::read( $item );
	$id = $item->get_id();
	$item->set_props(
		array(
			'method_id'   => get_metadata( 'order_item', $id, 'method_id', true ),
			'instance_id' => get_metadata( 'order_item', $id, 'instance_id', true ),
			'total'       => get_metadata( 'order_item', $id, 'cost', true ),
			'taxes'       => get_metadata( 'order_item', $id, 'taxes', true ),
		)
	);

	// BW compat.
	if ( '' === $item->get_instance_id() && strstr( $item->get_method_id(), ':' ) ) {
		$legacy_method_id = explode( ':', $item->get_method_id() );
		$item->set_method_id( $legacy_method_id[0] );
		$item->set_instance_id( $legacy_method_id[1] );
	}

	$item->set_object_read( true );
}