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:
Shahed Nasser
2024-10-16 10:25:21 +00:00
committed by GitHub
parent 6e856d3156
commit eed88c95ec
42 changed files with 594 additions and 582 deletions
@@ -10,7 +10,7 @@ In this document, youll learn how tax lines are calculated and what a tax pro
Tax lines are calculated and retrieved using the [getTaxLines method of the Tax Modules 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 carts 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"
}
]
```
---