---
displayed_sidebar: servicesSidebar
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# TaxRate

A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region.

## constructor

`**new TaxRate**()`

A Tax Rate can be used to define a custom rate to charge on specified products, product types, and shipping options within a given region.

___

## Properties

<ParameterTypes parameters={[
  {
    "name": "code",
    "type": "`null` \\| `string`",
    "description": "A code to identify the tax type by",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "created_at",
    "type": "`Date`",
    "description": "The date with timezone at which the resource was created.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "id",
    "type": "`string`",
    "description": "The tax rate's ID",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "metadata",
    "type": "`Record<string, unknown>`",
    "description": "An optional key-value map with additional details",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "name",
    "type": "`string`",
    "description": "A human friendly name for the tax",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "product_count",
    "type": "`number`",
    "description": "The count of products",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "product_type_count",
    "type": "`number`",
    "description": "The count of product types",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "product_types",
    "type": "[ProductType](ProductType.mdx)[]",
    "description": "The details of the product types that belong to this tax rate.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "products",
    "type": "[Product](Product.mdx)[]",
    "description": "The details of the products that belong to this tax rate.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "rate",
    "type": "`null` \\| `number`",
    "description": "The numeric rate to charge",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "region",
    "type": "[Region](Region.mdx)",
    "description": "The details of the region that the rate belongs to.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "region_id",
    "type": "`string`",
    "description": "The ID of the region that the rate belongs to.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "shipping_option_count",
    "type": "`number`",
    "description": "The count of shipping options",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "shipping_options",
    "type": "[ShippingOption](ShippingOption.mdx)[]",
    "description": "The details of the shipping options that belong to this tax rate.",
    "optional": false,
    "defaultValue": "",
    "expandable": true,
    "children": []
  },
  {
    "name": "updated_at",
    "type": "`Date`",
    "description": "The date with timezone at which the resource was updated.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} />

___

## Methods

### beforeInsert

`Private **beforeInsert**(): void`

#### Returns

`void`

<ParameterTypes parameters={[
  {
    "name": "void",
    "type": "`void`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />
