Automattic\WooCommerce\Admin\API\Reports\Stock
Controller::add_wp_query_join()
Join posts meta tables when product search or low stock query is present.
Метод класса: Controller{}
Хуков нет.
Возвращает
Строку
.
Использование
$result = Controller::add_wp_query_join( $join, $wp_query );
- $join(строка) (обязательный)
- Join clause used to search posts.
- $wp_query(объект) (обязательный)
- WP_Query object.
Код Controller::add_wp_query_join() Controller::add wp query join WC 9.3.1
public static function add_wp_query_join( $join, $wp_query ) { global $wpdb; $stock_status = $wp_query->get( 'stock_status' ); if ( $stock_status ) { $join = self::append_product_sorting_table_join( $join ); } if ( $wp_query->get( 'low_in_stock' ) ) { $join = self::append_product_sorting_table_join( $join ); $join .= " LEFT JOIN {$wpdb->postmeta} AS low_stock_amount_meta ON {$wpdb->posts}.ID = low_stock_amount_meta.post_id AND low_stock_amount_meta.meta_key = '_low_stock_amount' "; } return $join; }