set_props( array( 'discount' => get_metadata( 'order_item', $item->get_id(), 'discount_amount', true ), 'discount_tax' => get_metadata( 'order_item', $item->get_id(), 'discount_amount_tax', true ), ) ); } /** * Saves an item's data to the database / item meta. * Ran after both create and update, so $item->get_id() will be set. * * @since 2.7.0 * @param WC_Order_Item $item */ public function save_item_data( &$item ) { wc_update_order_item_meta( $item->get_id(), 'discount_amount', $item->get_discount( 'edit' ) ); wc_update_order_item_meta( $item->get_id(), 'discount_amount_tax', $item->get_discount_tax( 'edit' ) ); } }