@@ 1171-1196 (lines=26) @@ | ||
1168 | throw new WC_CLI_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again', 'woocommerce' ) ); |
|
1169 | } |
|
1170 | ||
1171 | } else { |
|
1172 | ||
1173 | $fee_args = array(); |
|
1174 | ||
1175 | if ( isset( $fee['title'] ) ) { |
|
1176 | $fee_args['name'] = $fee['title']; |
|
1177 | } |
|
1178 | ||
1179 | if ( isset( $fee['tax_class'] ) ) { |
|
1180 | $fee_args['tax_class'] = $fee['tax_class']; |
|
1181 | } |
|
1182 | ||
1183 | if ( isset( $fee['total'] ) ) { |
|
1184 | $fee_args['line_total'] = floatval( $fee['total'] ); |
|
1185 | } |
|
1186 | ||
1187 | if ( isset( $fee['total_tax'] ) ) { |
|
1188 | $fee_args['line_tax'] = floatval( $fee['total_tax'] ); |
|
1189 | } |
|
1190 | ||
1191 | $fee_id = $order->update_fee( $fee['id'], $fee_args ); |
|
1192 | ||
1193 | if ( ! $fee_id ) { |
|
1194 | throw new WC_CLI_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again', 'woocommerce' ) ); |
|
1195 | } |
|
1196 | } |
|
1197 | } |
|
1198 | ||
1199 | /** |
@@ 1159-1184 (lines=26) @@ | ||
1156 | throw new WC_API_Exception( 'woocommerce_cannot_create_fee', __( 'Cannot create fee, try again', 'woocommerce' ), 500 ); |
|
1157 | } |
|
1158 | ||
1159 | } else { |
|
1160 | ||
1161 | $fee_args = array(); |
|
1162 | ||
1163 | if ( isset( $fee['title'] ) ) { |
|
1164 | $fee_args['name'] = $fee['title']; |
|
1165 | } |
|
1166 | ||
1167 | if ( isset( $fee['tax_class'] ) ) { |
|
1168 | $fee_args['tax_class'] = $fee['tax_class']; |
|
1169 | } |
|
1170 | ||
1171 | if ( isset( $fee['total'] ) ) { |
|
1172 | $fee_args['line_total'] = floatval( $fee['total'] ); |
|
1173 | } |
|
1174 | ||
1175 | if ( isset( $fee['total_tax'] ) ) { |
|
1176 | $fee_args['line_tax'] = floatval( $fee['total_tax'] ); |
|
1177 | } |
|
1178 | ||
1179 | $fee_id = $order->update_fee( $fee['id'], $fee_args ); |
|
1180 | ||
1181 | if ( ! $fee_id ) { |
|
1182 | throw new WC_API_Exception( 'woocommerce_cannot_update_fee', __( 'Cannot update fee, try again', 'woocommerce' ), 500 ); |
|
1183 | } |
|
1184 | } |
|
1185 | } |
|
1186 | ||
1187 | /** |