upsertTaxRates - Tax Module Reference

This documentation provides a reference to the upsertTaxRates 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.

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

This method updates or creates a tax rate if it doesn't exist.

Example#

Code
1const taxRate = await taxModuleService.upsertTaxRates({2  id: "txr_123",3  rate: 10,4})

Parameters#

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

Returns#

PromisePromise<TaxRateDTO>
The created or updated tax rate.

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

This method updates or creates tax rates if they don't exist.

Example#

Code
1const taxRates = await taxModuleService.upsertTaxRates([2  {3    id: "txr_123",4    rate: 10,5  },6])

Parameters#

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

Returns#

PromisePromise<TaxRateDTO[]>
The created or updated tax rates.
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