WC_Abstract_Order::add_order_item_totals_discount_row()
Add total row for discounts.
Method of the class: WC_Abstract_Order{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->add_order_item_totals_discount_row( $total_rows, $tax_display );
- $total_rows(array) (required) (passed by reference — &)
- Reference to total rows array.
- $tax_display(string) (required)
- Excl or incl tax display mode.
WC_Abstract_Order::add_order_item_totals_discount_row() WC Abstract Order::add order item totals discount row code WC 9.3.1
protected function add_order_item_totals_discount_row( &$total_rows, $tax_display ) { if ( $this->get_total_discount() > 0 ) { $total_rows['discount'] = array( 'label' => __( 'Discount:', 'woocommerce' ), 'value' => '-' . $this->get_discount_to_display( $tax_display ), ); } }