diff --git a/includes/api/legacy/v2/class-wc-api-products.php b/includes/api/legacy/v2/class-wc-api-products.php index 72b463877e9..661e4219678 100644 --- a/includes/api/legacy/v2/class-wc-api-products.php +++ b/includes/api/legacy/v2/class-wc-api-products.php @@ -1076,10 +1076,11 @@ class WC_API_Products extends WC_API_Resource { $product->set_date_on_sale_to( $date_to ); $product->set_date_on_sale_from( $date_from ); + if ( $product->is_on_sale() ) { - $product->set_price( $product->get_sale_price() ); + $product->set_price( $product->get_sale_price( 'edit' ) ); } else { - $product->set_price( $product->get_regular_price() ); + $product->set_price( $product->get_regular_price( 'edit' ) ); } } diff --git a/includes/api/legacy/v3/class-wc-api-products.php b/includes/api/legacy/v3/class-wc-api-products.php index dbfc36ef6b3..e6e64d47ea0 100644 --- a/includes/api/legacy/v3/class-wc-api-products.php +++ b/includes/api/legacy/v3/class-wc-api-products.php @@ -1566,10 +1566,11 @@ class WC_API_Products extends WC_API_Resource { $product->set_date_on_sale_to( $date_to ); $product->set_date_on_sale_from( $date_from ); + if ( $product->is_on_sale() ) { - $product->set_price( $product->get_sale_price() ); + $product->set_price( $product->get_sale_price( 'edit' ) ); } else { - $product->set_price( $product->get_regular_price() ); + $product->set_price( $product->get_regular_price( 'edit' ) ); } }