Fix product variation sale_price_dates_to not being set to 23:59:59 when it's set via the variation bulk actions (#41564)
* sets sale price to 23:59:59 when sale schedule variation bulk action runs * made the date being sent in the CRUD object coherent with the rest of the wc codebase. added changelog file * fix issue raised by linter
This commit is contained in:
parent
f35d52203e
commit
5a851cba28
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix product variation sale_price_dates_to not being set to 23:59:59 when it's set via the variation bulk actions
|
|
@ -2714,11 +2714,13 @@ class WC_AJAX {
|
|||
$variation = wc_get_product( $variation_id );
|
||||
|
||||
if ( 'false' !== $data['date_from'] ) {
|
||||
$variation->set_date_on_sale_from( wc_clean( $data['date_from'] ) );
|
||||
$date_on_sale_from = date( 'Y-m-d 00:00:00', strtotime( wc_clean( $data['date_from'] ) ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
|
||||
$variation->set_date_on_sale_from( $date_on_sale_from );
|
||||
}
|
||||
|
||||
if ( 'false' !== $data['date_to'] ) {
|
||||
$variation->set_date_on_sale_to( wc_clean( $data['date_to'] ) );
|
||||
$date_on_sale_to = date( 'Y-m-d 23:59:59', strtotime( wc_clean( $data['date_to'] ) ) ); // phpcs:ignore WordPress.DateTime.RestrictedFunctions.date_date
|
||||
$variation->set_date_on_sale_to( $date_on_sale_to );
|
||||
}
|
||||
|
||||
$variation->save();
|
||||
|
|
Loading…
Reference in New Issue