Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Tax::has_existing_tax_ratesprivateWC 1.0

Determines if a tax rate exists in the database. Result is indefinitely cached.

Method of the class: Tax{}

No Hooks.

Returns

true|false.

Usage

// private - for code of main (parent) class only
$result = $this->has_existing_tax_rates();

Tax::has_existing_tax_rates() code WC 9.9.5

private function has_existing_tax_rates() {
	global $wpdb;
	$has_existing_tax_rates = wp_cache_get( self::TAX_RATE_EXISTS_CACHE_KEY );
	if ( false === $has_existing_tax_rates ) {
		$rate_exists            = (bool) $wpdb->get_var( "SELECT 1 FROM {$wpdb->prefix}woocommerce_tax_rates limit 1" );
		$has_existing_tax_rates = $rate_exists ? 'yes' : 'no';
		wp_cache_set( self::TAX_RATE_EXISTS_CACHE_KEY, $has_existing_tax_rates );
	}

	return 'yes' === $has_existing_tax_rates;
}