Automattic\WooCommerce\Blocks\BlockTypes
ProductCollection::get_filter_by_stock_status_query()
Return a query that filters products by stock status.
Метод класса: ProductCollection{}
Хуков нет.
Возвращает
Массив
.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_filter_by_stock_status_query();
Код ProductCollection::get_filter_by_stock_status_query() ProductCollection::get filter by stock status query WC 9.4.2
private function get_filter_by_stock_status_query() { $filter_stock_status_values = get_query_var( StockFilter::STOCK_STATUS_QUERY_VAR ); if ( empty( $filter_stock_status_values ) ) { return array(); } $filtered_stock_status_values = array_filter( explode( ',', $filter_stock_status_values ), function ( $stock_status ) { return in_array( $stock_status, StockFilter::get_stock_status_query_var_values(), true ); } ); if ( empty( $filtered_stock_status_values ) ) { return array(); } return array( // Ignoring the warning of not using meta queries. // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query 'meta_query' => array( array( 'key' => '_stock_status', 'value' => $filtered_stock_status_values, 'operator' => 'IN', ), ), ); }