Property | Type | Description | |
---|---|---|---|
$precision | integer | Precision. | |
$round_at_subtotal | boolean | Round at subtotal. |
Method | Description | |
---|---|---|
_delete_tax_rate ( integer $tax_rate_id ) | Delete a tax rate from the database. | |
_get_tax_rate ( integer $tax_rate_id, string $output_type = ARRAY_A ) : array | Get tax rate. | |
_insert_tax_rate ( array $tax_rate ) : integer | Insert a new tax rate. | |
_update_tax_rate ( integer $tax_rate_id, array $tax_rate ) | Update a tax rate. | |
_update_tax_rate_cities ( integer $tax_rate_id, string $cities ) : string | Update cities for a tax rate in the DB. | |
_update_tax_rate_postcodes ( integer $tax_rate_id, string $postcodes ) : string | Update postcodes for a tax rate in the DB. | |
calc_exclusive_tax ( float $price, array $rates ) : array | Calc tax from exclusive price. | |
calc_inclusive_tax ( float $price, array $rates ) : array | Calc tax from inclusive price. | |
calc_shipping_tax ( $price, $rates ) : array | Calculate the shipping tax using a passed array of rates. | |
calc_tax ( float $price, array $rates, boolean $price_includes_tax = false, boolean $suppress_rounding = false ) : array | Calculate tax for a line. | |
find_rates ( array $args = [] ) : array | Searches for all matching country/state/postcode tax rates. | |
find_shipping_rates ( array $args = [] ) : array | Searches for all matching country/state/postcode tax rates. | |
format_tax_rate_class ( string $class ) : string | format the class. | |
get_base_tax_rates ( $tax_class = '' ) : array | Get's an array of matching rates for the shop's base country. | |
get_rate_code ( mixed $key_or_rate ) : string | Get a rates code. Code is made up of COUNTRY-STATE-NAME-Priority. E.g GB-VAT-1, US-AL-TAX-1. | |
get_rate_label ( mixed $key_or_rate ) : string | Return a given rates label. | |
get_rate_percent ( mixed $key_or_rate ) : string | Return a given rates percent. | |
get_rates ( string $tax_class = '' ) : array | Get's an array of matching rates for a tax class. | |
get_rates_for_tax_class ( string $tax_class ) : array | null | object | Used by admin settings page. | |
get_shipping_tax_rates ( $tax_class = null ) : mixed | Gets an array of matching shipping tax rates for a given class. | |
get_shop_base_rate ( $tax_class = '' ) : array | Alias for get_base_tax_rates(). | |
get_tax_classes ( ) : array | Get store tax classes. | |
get_tax_location ( $tax_class = '' ) : array | Get the customer tax location based on their status and the current page. | |
get_tax_total ( $taxes ) : float | Round tax lines and return the sum. | |
init ( ) | Load options. | |
is_compound ( $key ) : boolean | Return true/false depending on if a rate is a compound rate. | |
maybe_remove_tax_class_rates ( string $old_value, string $value ) | When the woocommerce_tax_classes option is changed, remove any orphan rates. | |
round ( $in ) : double | Round to precision. |
Method | Description | |
---|---|---|
_update_tax_rate_locations ( integer $tax_rate_id, $values, string $type ) : string | Updates locations (postcode and city). | |
format_tax_rate ( double $rate ) : string | format the rate. | |
format_tax_rate_city ( string $city ) : string | format the city. | |
format_tax_rate_country ( string $country ) : string | format the country. | |
format_tax_rate_name ( string $name ) : string | format the tax rate name. | |
format_tax_rate_priority ( string $priority ) : integer | format the priority. | |
format_tax_rate_state ( string $state ) : string | format the state. | |
get_matched_tax_rates ( string $country, string $state, string $postcode, string $city, string $tax_class ) : array | Loop through a set of tax rates and get the matching rates (1 per priority). | |
precision ( float $price ) : float | Multiply cost by pow precision. | |
prepare_tax_rate ( array $tax_rate ) : array | Prepare and format tax rate for DB insertion. | |
remove_precision ( float $price ) : float | Divide cost by pow precision. | |
sort_rates ( array $rates ) : array | Logical sort order for tax rates based on the following in order of priority: - Priority - County code - State code | |
sort_rates_callback ( $rate1, $rate2 ) | Does the sort comparison. |
public static _delete_tax_rate ( integer $tax_rate_id ) | ||
$tax_rate_id | integer |
public static _insert_tax_rate ( array $tax_rate ) : integer | ||
$tax_rate | array | |
return | integer | tax rate id |
public static _update_tax_rate ( integer $tax_rate_id, array $tax_rate ) | ||
$tax_rate_id | integer | |
$tax_rate | array |
public static calc_shipping_tax ( $price, $rates ) : array | ||
return | array |
public static calc_tax ( float $price, array $rates, boolean $price_includes_tax = false, boolean $suppress_rounding = false ) : array | ||
$price | float | Price to calc tax on |
$rates | array | Rates to apply |
$price_includes_tax | boolean | Whether the passed price has taxes included |
$suppress_rounding | boolean | Whether to suppress any rounding from taking place |
return | array | Array of rates + prices after tax |
public static find_rates ( array $args = [] ) : array | ||
$args | array | |
return | array |
public static find_shipping_rates ( array $args = [] ) : array | ||
$args | array | |
return | array |
public static format_tax_rate_class ( string $class ) : string | ||
$class | string | |
return | string |
public static get_base_tax_rates ( $tax_class = '' ) : array | ||
return | array |
public static get_rate_code ( mixed $key_or_rate ) : string | ||
$key_or_rate | mixed | Tax rate ID, or the db row itself in object format |
return | string |
public static get_rate_label ( mixed $key_or_rate ) : string | ||
$key_or_rate | mixed | Tax rate ID, or the db row itself in object format |
return | string |
public static get_rate_percent ( mixed $key_or_rate ) : string | ||
$key_or_rate | mixed | Tax rate ID, or the db row itself in object format |
return | string |
public static get_shipping_tax_rates ( $tax_class = null ) : mixed | ||
return | mixed |
public static get_shop_base_rate ( $tax_class = '' ) : array | ||
return | array |
public static get_tax_classes ( ) : array | ||
return | array |
public static get_tax_location ( $tax_class = '' ) : array | ||
$tax_class | string Optional, passed to the filter for advanced tax setups. | |
return | array |
public static get_tax_total ( $taxes ) : float | ||
return | float |
public static is_compound ( $key ) : boolean | ||
return | boolean |
public static maybe_remove_tax_class_rates ( string $old_value, string $value ) | ||
$old_value | string | |
$value | string |
public static round ( $in ) : double | ||
return | double |
public static bool $round_at_subtotal | ||
return | boolean |