Automattic\WooCommerce\Admin\Features\Blueprint\Importers

ImportSetWCTaxRates::exist()protectedWC 1.0

Check if a tax rate exists in the database.

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

Хуков нет.

Возвращает

Массив|null. The tax rate row if found, null otherwise.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->exist( $id );
$id(int) (обязательный)
The tax rate ID.

Заметки

  • Global. \wpdb. $wpdb WordPress database abstraction object.

Код ImportSetWCTaxRates::exist() WC 9.7.1

protected function exist( $id ) {
	global $wpdb;
	return $wpdb->get_row(
		$wpdb->prepare(
			"
                SELECT *
                FROM {$wpdb->prefix}woocommerce_tax_rates
                WHERE tax_rate_id = %d
                ",
			$id
		),
		ARRAY_A
	);
}