Merge pull request #12679 from franticpsyx/rest-api-totals-excl-tax

[2.7] Calculate REST order item totals excluding tax if undefined (?)
This commit is contained in:
Mike Jolley 2016-12-23 14:17:07 +00:00 committed by GitHub
commit e8b1fe1bf2
1 changed files with 2 additions and 1 deletions

View File

@ -559,7 +559,8 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
$item->set_product( $product );
if ( 'create' === $action ) {
$total = $product->get_price() * ( isset( $posted['quantity'] ) ? $posted['quantity'] : 1 );
$quantity = isset( $posted['quantity'] ) ? $posted['quantity'] : 1;
$total = wc_get_price_excluding_tax( $product, array( 'qty' => $quantity ) );
$item->set_total( $total );
$item->set_subtotal( $total );
}