Automattic\WooCommerce\Admin\API\Reports\Taxes\Stats
DataStore::get_taxes()
Get taxes associated with a store.
Метод класса: DataStore{}
Хуков нет.
Возвращает
Массив
. An array of all taxes.
Использование
$result = DataStore::get_taxes( $args );
- $args(массив) (обязательный)
- Array of args to filter the query by. Supports include.
Код DataStore::get_taxes() DataStore::get taxes WC 9.3.1
public static function get_taxes( $args ) { global $wpdb; $query = " SELECT tax_rate_id, tax_rate_country, tax_rate_state, tax_rate_name, tax_rate_priority FROM {$wpdb->prefix}woocommerce_tax_rates "; if ( ! empty( $args['include'] ) ) { $args['include'] = (array) $args['include']; /* phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared */ $tax_placeholders = implode( ',', array_fill( 0, count( $args['include'] ), '%d' ) ); $query .= $wpdb->prepare( " WHERE tax_rate_id IN ({$tax_placeholders})", $args['include'] ); /* phpcs:enable */ } return $wpdb->get_results( $query, ARRAY_A ); // WPCS: cache ok, DB call ok, unprepared SQL ok. }