Automattic\WooCommerce\Blocks\AIContent

UpdateProducts::fetch_product_ids()publicWC 1.0

Return all existing products that have the _headstart_post meta assigned to them.

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

Хуков нет.

Возвращает

Массив|null.

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

$UpdateProducts = new UpdateProducts();
$UpdateProducts->fetch_product_ids( $type );
$type(строка)
The type of products to fetch.
По умолчанию: 'user_created'

Код UpdateProducts::fetch_product_ids() WC 9.5.1

public function fetch_product_ids( string $type = 'user_created' ) {
	global $wpdb;

	if ( 'user_created' === $type ) {
		return $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE ID NOT IN ( SELECT p.ID FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id WHERE pm.meta_key = %s AND p.post_type = 'product' AND p.post_status = 'publish' ) AND post_type = 'product' AND post_status = 'publish' LIMIT 6", '_headstart_post' ) );
	}

	return $wpdb->get_results( $wpdb->prepare( "SELECT p.ID FROM {$wpdb->posts} p JOIN {$wpdb->postmeta} pm ON p.ID = pm.post_id WHERE pm.meta_key = %s AND p.post_type = 'product' AND p.post_status = 'publish'", '_headstart_post' ) );
}