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:
commit
6520ea493d
|
@ -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' ) );
|
||||
|
|
|
@ -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' ) );
|
||||
|
|
Loading…
Reference in New Issue