Automattic\WooCommerce\Admin\API

ProductVariations::add_wp_query_join()public staticWC 1.0

Join posts meta tables when variation search query is present.

Метод класса: ProductVariations{}

Хуков нет.

Возвращает

Строку.

Использование

$result = ProductVariations::add_wp_query_join( $join, $wp_query );
$join(строка) (обязательный)
Join clause used to search posts.
$wp_query(объект) (обязательный)
WP_Query object.

Код ProductVariations::add_wp_query_join() WC 9.3.3

public static function add_wp_query_join( $join, $wp_query ) {
	global $wpdb;

	$search = $wp_query->get( 'search' );
	if ( $search ) {
		$join .= " LEFT JOIN {$wpdb->postmeta} AS attr_search_meta
					ON {$wpdb->posts}.ID = attr_search_meta.post_id
					AND attr_search_meta.meta_key LIKE 'attribute_%' ";
	}

	if ( wc_product_sku_enabled() && ! strstr( $join, 'wc_product_meta_lookup' ) ) {
		$join .= " LEFT JOIN {$wpdb->wc_product_meta_lookup} wc_product_meta_lookup
					ON $wpdb->posts.ID = wc_product_meta_lookup.product_id ";
	}

	return $join;
}