Automattic\WooCommerce\Admin\API

ProductsLowInStock::get_base_query()privateWC 1.0

Return a query string for low in stock products. The query string includes the following replacement strings:

  • :selects
  • :postmeta_join
  • :postmeta_wheres
  • :orderAndLimit

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

Хуков нет.

Возвращает

Строку.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_base_query( $replacements );
$replacements(массив)
of replacement strings.
По умолчанию: array()

Код ProductsLowInStock::get_base_query() WC 9.4.2

private function get_base_query( $replacements = array() ) {
	global $wpdb;
	$query = "
		SELECT
			:selects
		FROM
		  {$wpdb->wc_product_meta_lookup} wc_product_meta_lookup
		  LEFT JOIN {$wpdb->posts} wp_posts ON wp_posts.ID = wc_product_meta_lookup.product_id
		  :postmeta_join
		WHERE
		  wp_posts.post_type IN ('product', 'product_variation')
		  AND wp_posts.post_status = %s
		  AND wc_product_meta_lookup.stock_quantity IS NOT NULL
		  AND wc_product_meta_lookup.stock_status IN('instock', 'outofstock')
		  :postmeta_wheres
		  :orderAndLimit
	";

	return strtr( $query, $replacements );
}