Merge pull request #13460 from woocommerce/fix-13458
Set line item prices on legacy API order create
This commit is contained in:
commit
ee276e10a4
|
@ -918,6 +918,10 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
}
|
||||
if ( isset( $item['total'] ) ) {
|
||||
$line_item->set_total( floatval( $item['total'] ) );
|
||||
} elseif ( $creating ) {
|
||||
$total = wc_get_price_excluding_tax( $product, array( 'qty' => $line_item->get_quantity() ) );
|
||||
$line_item->set_total( $total );
|
||||
$line_item->set_subtotal( $total );
|
||||
}
|
||||
if ( isset( $item['total_tax'] ) ) {
|
||||
$line_item->set_total_tax( floatval( $item['total_tax'] ) );
|
||||
|
|
|
@ -967,6 +967,10 @@ class WC_API_Orders extends WC_API_Resource {
|
|||
}
|
||||
if ( isset( $item['total'] ) ) {
|
||||
$line_item->set_total( floatval( $item['total'] ) );
|
||||
} elseif ( $creating ) {
|
||||
$total = wc_get_price_excluding_tax( $product, array( 'qty' => $line_item->get_quantity() ) );
|
||||
$line_item->set_total( $total );
|
||||
$line_item->set_subtotal( $total );
|
||||
}
|
||||
if ( isset( $item['total_tax'] ) ) {
|
||||
$line_item->set_total_tax( floatval( $item['total_tax'] ) );
|
||||
|
|
Loading…
Reference in New Issue