docs: improved commerce modules [5/5] (#9592)
- Improve remaining commerce modules - Other: add a note about using methods of the modules' main services.
This commit is contained in:
@@ -10,7 +10,7 @@ In this document, you’ll learn how tax lines are calculated and what a tax pro
|
||||
|
||||
Tax lines are calculated and retrieved using the [getTaxLines method of the Tax Module’s main service](/references/tax/getTaxLines). It accepts an array of line items and shipping methods, and the context of the calculation.
|
||||
|
||||
It returns the tax lines that are used to adjust the cart’s tax and grand totals.
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const taxLines = await taxModuleService.getTaxLines(
|
||||
@@ -37,7 +37,28 @@ const taxLines = await taxModuleService.getTaxLines(
|
||||
|
||||
The context object is used to determine which tax regions and rates to use in the calculation. It includes properties related to the address and customer.
|
||||
|
||||
The example above returns the tax lines based on the tax region for the United States.
|
||||
The example above retrieves the tax lines based on the tax region for the United States.
|
||||
|
||||
The method returns tax lines for the line item and shipping methods. For example:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"line_item_id": "cali_123",
|
||||
"rate_id": "txr_1",
|
||||
"rate": 10,
|
||||
"code": "XXX",
|
||||
"name": "Tax Rate 1"
|
||||
},
|
||||
{
|
||||
"shipping_line_id": "casm_123",
|
||||
"rate_id": "txr_2",
|
||||
"rate": 5,
|
||||
"code": "YYY",
|
||||
"name": "Tax Rate 2"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user