WC_Order_Item_Coupon_Data_Store::read()publicWC 3.0.0

Read/populate data properties specific to this order item.

Method of the class: WC_Order_Item_Coupon_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Order_Item_Coupon_Data_Store = new WC_Order_Item_Coupon_Data_Store();
$WC_Order_Item_Coupon_Data_Store->read( $item );
$item(WC_Order_Item_Coupon) (required) (passed by reference — &)
Coupon order item.

Changelog

Since 3.0.0 Introduced.

WC_Order_Item_Coupon_Data_Store::read() code WC 9.4.2

public function read( &$item ) {
	parent::read( $item );
	$id = $item->get_id();
	$item->set_props(
		array(
			'discount'     => get_metadata( 'order_item', $id, 'discount_amount', true ),
			'discount_tax' => get_metadata( 'order_item', $id, 'discount_amount_tax', true ),
		)
	);
	$item->set_object_read( true );
}