WC_Product_Data_Store_CPT::get_ending_sales()
Returns an array of IDs of products that have sales which are due to end.
Метод класса: WC_Product_Data_Store_CPT{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT(); $WC_Product_Data_Store_CPT->get_ending_sales();
Список изменений
С версии 3.0.0 | Введена. |
Код WC_Product_Data_Store_CPT::get_ending_sales() WC Product Data Store CPT::get ending sales WC 8.7.0
public function get_ending_sales() { global $wpdb; // phpcs:ignore WordPress.VIP.DirectDatabaseQuery.DirectQuery return $wpdb->get_col( $wpdb->prepare( "SELECT postmeta.post_id FROM {$wpdb->postmeta} as postmeta LEFT JOIN {$wpdb->postmeta} as postmeta_2 ON postmeta.post_id = postmeta_2.post_id LEFT JOIN {$wpdb->postmeta} as postmeta_3 ON postmeta.post_id = postmeta_3.post_id WHERE postmeta.meta_key = '_sale_price_dates_to' AND postmeta_2.meta_key = '_price' AND postmeta_3.meta_key = '_regular_price' AND postmeta.meta_value > 0 AND postmeta.meta_value < %s AND postmeta_2.meta_value != postmeta_3.meta_value", time() ) ); }