|
1
|
export const metadata = { |
|
2
|
title: `Tax-Inclusive Pricing`, |
|
3
|
} |
|
4
|
|
|
5
|
# {metadata.title} |
|
6
|
|
|
7
|
In this document, you’ll learn about tax-inclusive pricing and how it's used when calculating prices. |
|
8
|
|
|
9
|
## What is Tax-Inclusive Pricing? |
|
10
|
|
|
11
|
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. |
|
12
|
|
|
13
|
For example, if a product’s 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. |
|
14
|
|
|
15
|
--- |
|
16
|
|
|
17
|
## How is Tax-Inclusive Pricing Set? |
|
18
|
|
|
19
|
The [PricePreference data model](/references/pricing/models/PricePreference) holds the tax-inclusive setting for a context. It has two properties that indicate the context: |
|
20
|
|
|
21
|
- `attribute`: The name of the attribute to compare against. For example, `region_id` or `currency_code`. |
|
22
|
- `value`: The attribute’s value. For example, `reg_123` or `usd`. |
|
23
|
|
|
24
|
<Note> |
|
25
|
|
|
26
|
Only `region_id` and `currency_code` are supported as an `attribute` at the moment. |
|
27
|
|
|
28
|
</Note> |
|
29
|
|
|
30
|
The `is_tax_inclusive` property indicates whether tax-inclusivity is enabled in the specified context. |
|
31
|
|
|
32
|
For example: |
|
33
|
|
|
34
|
```json |
|
35
|
{ |
|
36
|
"attribute": "currency_code", |
|
37
|
"value": "USD", |
|
38
|
"is_tax_inclusive": true, |
|
39
|
} |
|
40
|
``` |
|
41
|
|
|
42
|
In this example, tax-inclusivity is enabled for the `USD` currency code. |
|
43
|
|
|
44
|
--- |
|
45
|
|
|
46
|
## Tax-Inclusive Pricing in Price Calculation |
|
47
|
|
|
48
|
### Tax Context |
|
49
|
|
|
50
|
As mentioned in the [Price Calculation documentation](../price-calculation/page.mdx#calculation-context), The `calculatePrices` method accepts as a parameter a calculation context. |
|
51
|
|
|
52
|
To get accurate tax results, pass the `region_id` and / or `currency_code` in the calculation context. |
|
53
|
|
|
54
|
### Returned Tax Properties |
|
55
|
|
|
56
|
The `calculatePrices` method returns two properties related to tax-inclusivity: |
|
57
|
|
|
58
|
<Note title="Tip"> |
|
59
|
|
|
60
|
Learn more about the returned properties in [this guide](../price-calculation/page.mdx#returned-price-object). |
|
61
|
|
|
62
|
</Note> |
|
63
|
|
|
64
|
- `is_calculated_price_tax_inclusive`: Whether the selected `calculated_price` is tax-inclusive. |
|
65
|
- `is_original_price_tax_inclusive` : Whether the selected `original_price` is tax-inclusive. |
|
66
|
|
|
67
|
A price is considered tax-inclusive if: |
|
68
|
|
|
69
|
1. It belongs to the region or currency code specified in the calculation context; |
|
70
|
2. and the region or currency code has a price preference with `is_tax_inclusive` enabled. |
|
71
|
|
|
72
|
### Tax Context Precedence |
|
73
|
|
|
74
|
A region’s price preference’s `is_tax_inclusive`'s value takes higher precedence in determining whether a price is tax-inclusive if: |
|
75
|
|
|
76
|
- both the `region_id` and `currency_code` are provided in the calculation context; |
|
77
|
- the selected price belongs to the region; |
|
78
|
- and the region has a price preference |
|
79
|
|
|
80
|
--- |
|
81
|
|
|
82
|
## Tax-Inclusive Pricing with Promotions |
|
83
|
|
|
84
|
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. |
|
85
|
|
|
86
|
Learn more in the [Tax-Inclusive Promotions](../../promotion/promotion-taxes/page.mdx) guide. |