WC_AJAX::variation_bulk_action_variable_sale_schedule()
Bulk action - Sale Schedule.
Метод класса: WC_AJAX{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WC_AJAX::variation_bulk_action_variable_sale_schedule( $variations, $data );
- $variations(массив) (обязательный)
- List of variations.
- $data(массив) (обязательный)
- Data to set.
Код WC_AJAX::variation_bulk_action_variable_sale_schedule() WC AJAX::variation bulk action variable sale schedule WC 9.2.3
private static function variation_bulk_action_variable_sale_schedule( $variations, $data ) { if ( ! isset( $data['date_from'] ) && ! isset( $data['date_to'] ) ) { return; } foreach ( $variations as $variation_id ) { $variation = wc_get_product( $variation_id ); if ( 'false' !== $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'] ) { $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(); } }