Automattic\WooCommerce\Admin\Features\Blueprint\Importers

ImportSetWCTaxRates::exist()protectedWC 1.0

Check if a tax rate exists in the database.

Method of the class: ImportSetWCTaxRates{}

No Hooks.

Return

Array|null. The tax rate row if found, null otherwise.

Usage

// protected - for code of main (parent) or child class
$result = $this->exist( $id );
$id(int) (required)
The tax rate ID.

Notes

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

ImportSetWCTaxRates::exist() code 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
	);
}