hook_commerce_tax_rate_info
| 7 commerce_tax.api.php |
hook_commerce_tax_rate_info() |
Defines tax rates that may be applied to line items.
Return value
An array of information about available tax rates. The returned array
should be an associative array of tax rate arrays keyed by the tax rate
name. Each tax rate array can include the following keys:
- title: the title of the tax rate
- display_title: a display title for the tax type suitable for presenting
to customers if necessary; defaults to the title
- description: a short description of the tax rate
- rate: the percentage used to calculate this tax expressed as a decimal
- type: the name of the tax type this rate belongs to
- rules_component: name of the Rules component (if any) defined for
determining the applicability of the tax to a line item; defaults to
'commerce_tax_rate_[name]'.
- default_rules_component: boolean indicating whether or not the Tax module
should define a default default Rules component using the specified name;
defaults to TRUE.
- price_component: name of the price component defined for this tax rate
used when the tax is added to a line item; if set to FALSE, no price
component will be defined for this tax rate
- admin_list: boolean defined by the Tax UI module determining whether or
not the tax rate should appear in the admin list
- calculation_callback: name of the function used to calculate the tax
amount for a given line item, returning either a tax price array to be
added as a component to the line item's unit price or FALSE to not
include anything; defaults to 'commerce_tax_rate_calculate'.
File
- contributions/commerce/modules/tax/commerce_tax.api.php, line 128
- Documents hooks provided by the Tax module.
Code
function hook_commerce_tax_rate_info() {
$tax_rates = array();
$tax_rates['ky_sales_tax'] = array(
'title' => t('KY sales tax'),
'rate' => .06,
'type' => 'sales_tax',
);
return $tax_rates;
}