getTaxLines - Tax Module Reference

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

This method retrieves tax lines for taxable items and shipping methods in a cart.

Learn more in this guide.

Example#

Code
1const taxLines = await taxModuleService.getTaxLines(2  [3    {4      id: "cali_123",5      product_id: "prod_123",6      unit_price: 1000,7      quantity: 1,8    },9    {10      id: "casm_123",11      shipping_option_id: "so_123",12      unit_price: 2000,13    },14  ],15  {16    address: {17      country_code: "us",18    },19  }20)

Parameters#

The items and shipping methods to retrieve their tax lines.
calculationContextTaxCalculationContext
The context to pass to the underlying tax provider. It provides more details that are useful to provide accurate tax lines.
sharedContextContextOptional
A context used to share resources, such as transaction manager, between the application and the module.

Returns#

PromisePromise<(ItemTaxLineDTO | ShippingTaxLineDTO)[]>
The item and shipping methods' tax lines.
Was this page helpful?