Merge pull request #18099 from aelia-co/fix-legacy_api-use_edit_context_when_setting_prices

Legacy API - Use "edit" context when checking if the product is on sale during an "edit" operation
This commit is contained in:
Claudiu Lodromanean 2017-12-11 11:48:19 -08:00 committed by GitHub
commit 6520ea493d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1077,7 +1077,7 @@ 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() ) {
if ( $product->is_on_sale( 'edit' ) ) {
$product->set_price( $product->get_sale_price( 'edit' ) );
} else {
$product->set_price( $product->get_regular_price( 'edit' ) );

View File

@ -1567,7 +1567,7 @@ 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() ) {
if ( $product->is_on_sale( 'edit' ) ) {
$product->set_price( $product->get_sale_price( 'edit' ) );
} else {
$product->set_price( $product->get_regular_price( 'edit' ) );