createTaxRates - Tax Module Reference

This documentation provides a reference to the createTaxRates method. This belongs to the Tax Module.

NoteYou should only use this methods when implementing complex customizations. For common cases, check out available workflows instead.

createTaxRates(data, sharedContext?): Promise<TaxRateDTO[]>#

This method creates tax rates.

Example#

Code
1const taxRates = await taxModuleService.createTaxRates([2  {3    tax_region_id: "txreg_123",4    name: "Default rate",5    rate: 10,6  },7  {8    tax_region_id: "txreg_123",9    name: "Custom rate",10    rate: 15,11    rules: [12      {13        reference: "product_type",14        reference_id: "ptyp_1",15      },16      {17        reference: "product",18        reference_id: "prod_123",19      },20    ],21  },22])

Parameters#

The tax rates to be created.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<TaxRateDTO[]>
The created tax rates.

createTaxRates(data, sharedContext?): Promise<TaxRateDTO>#

This method creates a tax rate.

Example#

Code
1const taxRate = await taxModuleService.createTaxRates({2  tax_region_id: "txreg_123",3  name: "Default rate",4  rate: 10,5})

Parameters#

The tax rate to be created.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<TaxRateDTO>
The created tax rate.
Was this page helpful?
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break