@@ 1146-1163 (lines=18) @@ | ||
1143 | $order_fee->tax_class = ''; |
|
1144 | ||
1145 | // if taxable, tax class and total are required |
|
1146 | if ( isset( $fee['taxable'] ) && $fee['taxable'] ) { |
|
1147 | ||
1148 | if ( ! isset( $fee['tax_class'] ) ) { |
|
1149 | throw new WC_CLI_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable', 'woocommerce' ) ); |
|
1150 | } |
|
1151 | ||
1152 | $order_fee->taxable = true; |
|
1153 | $order_fee->tax_class = $fee['tax_class']; |
|
1154 | ||
1155 | if ( isset( $fee['total_tax'] ) ) { |
|
1156 | $order_fee->tax = isset( $fee['total_tax'] ) ? wc_format_refund_total( $fee['total_tax'] ) : 0; |
|
1157 | } |
|
1158 | ||
1159 | if ( isset( $fee['tax_data'] ) ) { |
|
1160 | $order_fee->tax = wc_format_refund_total( array_sum( $fee['tax_data'] ) ); |
|
1161 | $order_fee->tax_data = array_map( 'wc_format_refund_total', $fee['tax_data'] ); |
|
1162 | } |
|
1163 | } |
|
1164 | ||
1165 | $fee_id = $order->add_fee( $order_fee ); |
|
1166 |
@@ 1134-1151 (lines=18) @@ | ||
1131 | $order_fee->tax_class = ''; |
|
1132 | ||
1133 | // if taxable, tax class and total are required |
|
1134 | if ( isset( $fee['taxable'] ) && $fee['taxable'] ) { |
|
1135 | ||
1136 | if ( ! isset( $fee['tax_class'] ) ) { |
|
1137 | throw new WC_API_Exception( 'woocommerce_invalid_fee_item', __( 'Fee tax class is required when fee is taxable', 'woocommerce' ), 400 ); |
|
1138 | } |
|
1139 | ||
1140 | $order_fee->taxable = true; |
|
1141 | $order_fee->tax_class = $fee['tax_class']; |
|
1142 | ||
1143 | if ( isset( $fee['total_tax'] ) ) { |
|
1144 | $order_fee->tax = isset( $fee['total_tax'] ) ? wc_format_refund_total( $fee['total_tax'] ) : 0; |
|
1145 | } |
|
1146 | ||
1147 | if ( isset( $fee['tax_data'] ) ) { |
|
1148 | $order_fee->tax = wc_format_refund_total( array_sum( $fee['tax_data'] ) ); |
|
1149 | $order_fee->tax_data = array_map( 'wc_format_refund_total', $fee['tax_data'] ); |
|
1150 | } |
|
1151 | } |
|
1152 | ||
1153 | $fee_id = $order->add_fee( $order_fee ); |
|
1154 |