Files

87 lines
2.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export const metadata = {
title: `Tax-Inclusive Pricing`,
}
# {metadata.title}
In this document, youll learn about tax-inclusive pricing and how it's used when calculating prices.
## What is Tax-Inclusive Pricing?
A tax-inclusive price is a price of a resource that includes taxes. Medusa calculates the tax amount from the price rather than adds the amount to it.
For example, if a products price is $50, the tax rate is 2%, and tax-inclusive pricing is enabled, then the product's price is $49, and the applied tax amount is $1.
---
## How is Tax-Inclusive Pricing Set?
The [PricePreference data model](/references/pricing/models/PricePreference) holds the tax-inclusive setting for a context. It has two properties that indicate the context:
- `attribute`: The name of the attribute to compare against. For example, `region_id` or `currency_code`.
- `value`: The attributes value. For example, `reg_123` or `usd`.
<Note>
Only `region_id` and `currency_code` are supported as an `attribute` at the moment.
</Note>
The `is_tax_inclusive` property indicates whether tax-inclusivity is enabled in the specified context.
For example:
```json
{
"attribute": "currency_code",
"value": "USD",
"is_tax_inclusive": true,
}
```
In this example, tax-inclusivity is enabled for the `USD` currency code.
---
## Tax-Inclusive Pricing in Price Calculation
### Tax Context
As mentioned in the [Price Calculation documentation](../price-calculation/page.mdx#calculation-context), The `calculatePrices` method accepts as a parameter a calculation context.
To get accurate tax results, pass the `region_id` and / or `currency_code` in the calculation context.
### Returned Tax Properties
The `calculatePrices` method returns two properties related to tax-inclusivity:
<Note title="Tip">
Learn more about the returned properties in [this guide](../price-calculation/page.mdx#returned-price-object).
</Note>
- `is_calculated_price_tax_inclusive`: Whether the selected `calculated_price` is tax-inclusive.
- `is_original_price_tax_inclusive` : Whether the selected `original_price` is tax-inclusive.
A price is considered tax-inclusive if:
1. It belongs to the region or currency code specified in the calculation context;
2. and the region or currency code has a price preference with `is_tax_inclusive` enabled.
### Tax Context Precedence
A regions price preferences `is_tax_inclusive`'s value takes higher precedence in determining whether a price is tax-inclusive if:
- both the `region_id` and `currency_code` are provided in the calculation context;
- the selected price belongs to the region;
- and the region has a price preference
---
## Tax-Inclusive Pricing with Promotions
When you enable tax-inclusive prices for regions or currencies, this can impact how promotions are applied to the cart. So, it's recommended to enable tax-inclusiveness for promotions as well.
Learn more in the [Tax-Inclusive Promotions](../../promotion/promotion-taxes/page.mdx) guide.