Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Products::count_user_productspublicWC 1.0

Method of the class: Products{}

No Hooks.

Returns

null. Nothing (null).

Usage

$Products = new Products();
$Products->;

Products::count_user_products() code WC 9.9.5

		/*
		 * Check if any valid products exist and return 'yes' or 'no'
		 * A valid product must:
		 * 1. Be a published product post type
		 * 2. Meet one of these conditions:
		 *    - Have been edited by a user (_edit_last meta exists), OR
		 *    - Not have _headstart_post meta, OR
		 *    - Have _headstart_post meta but it's NULL
		 */
		$value = $wpdb->get_var(
			$wpdb->prepare(
				"SELECT IF(
					EXISTS (
						SELECT 1 FROM {$wpdb->posts} p
						WHERE p.post_type = %s
						AND p.post_status = %s
						AND (
							EXISTS (
								SELECT 1 FROM {$wpdb->postmeta} pm
								WHERE pm.post_id = p.ID
								AND pm.meta_key = %s