Fixed prepare_line_items for v1

This commit is contained in:
Claudio Sanches 2019-12-18 13:26:28 -03:00
parent 48fb4433ac
commit 218f1b1edb
1 changed files with 1 additions and 1 deletions

View File

@ -660,7 +660,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller {
*/
protected function prepare_line_items( $posted, $action = 'create' ) {
$item = new WC_Order_Item_Product( ! empty( $posted['id'] ) ? $posted['id'] : '' );
$product = wc_get_product( $this->get_product_id( $posted, $item->get_product() ) );
$product = wc_get_product( $this->get_product_id( $posted, $action ) );
if ( $product && $product !== $item->get_product() ) {
$item->set_product( $product );