docs: improve commerce modules [1/n] (#9498)

Improve and add docs for API Key, Auth, and Cart Modules

[1/n]
This commit is contained in:
Shahed Nasser
2024-10-11 15:19:13 +00:00
committed by GitHub
parent dd162d69be
commit 69b9e73be7
29 changed files with 1025 additions and 323 deletions
@@ -16,7 +16,7 @@ A tax line indicates the tax rate of a line item or a shipping method. The [Line
## Tax Inclusivity
By default, the tax amount is calculated by taking the tax rate from the line item or shipping methods amount, and then added to the item/methods subtotal.
By default, the tax amount is calculated by taking the tax rate from the line item or shipping methods amount, and then adding them to the item/methods subtotal.
However, line items and shipping methods have an `is_tax_inclusive` property that, when enabled, indicates that the item or methods price already includes taxes.
@@ -30,9 +30,11 @@ The following diagram is a simplified showcase of how a subtotal is calculated f
![A diagram showing an example of calculating the subtotal of a line item using its taxes](https://res.cloudinary.com/dza7lstvk/image/upload/v1711535295/Medusa%20Resources/cart-tax-inclusive_shpr3t.jpg)
For example, if a line item's amount is `5000`, the tax rate is `10`, and tax inclusivity is enabled, the tax amount is 10% of `5000`, which is `500`, making the unit price of the line item `4500`.
---
## Retrieving Tax Lines
## Retrieve Tax Lines
When using the Cart and Tax modules together, you can use the `getTaxLines` method of the Tax Modules main service. It retrieves the tax lines for a carts line items and shipping methods.