|
1
|
--- |
|
2
|
tags: |
|
3
|
- tax |
|
4
|
product: |
|
5
|
- cart |
|
6
|
- tax |
|
7
|
--- |
|
8
|
|
|
9
|
export const metadata = { |
|
10
|
title: `Tax-Inclusive Promotions`, |
|
11
|
} |
|
12
|
|
|
13
|
# {metadata.title} |
|
14
|
|
|
15
|
In this guide, you’ll learn how taxes are applied to promotions in a cart. |
|
16
|
|
|
17
|
<Note> |
|
18
|
|
|
19
|
This feature is available from [Medusa v2.8.5](https://github.com/medusajs/medusa/releases/tag/v2.8.5). |
|
20
|
|
|
21
|
</Note> |
|
22
|
|
|
23
|
## What are Tax-Inclusive Promotions? |
|
24
|
|
|
25
|
By default, promotions are tax-exclusive, meaning that the discount amount is applied as-is to the cart before taxes are calculated and applied to the cart total. |
|
26
|
|
|
27
|
A tax-inclusive promotion is a promotion for which taxes are calculated from the discount amount entered by the merchant. |
|
28
|
|
|
29
|
When a promotion is tax-inclusive, the discount amount is reduced by the calculated tax amount based on the [tax region's rate](../../tax/tax-region/page.mdx). The reduced discount amount is then applied to the cart total. |
|
30
|
|
|
31
|
<Note> |
|
32
|
|
|
33
|
Tax-inclusiveness doesn't apply to Buy X Get Y promotions. |
|
34
|
|
|
35
|
</Note> |
|
36
|
|
|
37
|
### When to Use Tax-Inclusive Promotions |
|
38
|
|
|
39
|
Tax-inclusive promotions are most useful when using [tax-inclusive prices](../../pricing/tax-inclusive-pricing/page.mdx) for items in the cart. |
|
40
|
|
|
41
|
In this scenario, Medusa applies taxes consistently across the cart, ensuring that the total price reflects the taxes and promotions correctly. |
|
42
|
|
|
43
|
You can see this in action in the [examples below](#tax-inclusiveness-examples). |
|
44
|
|
|
45
|
--- |
|
46
|
|
|
47
|
## What Makes a Promotion Tax-Inclusive? |
|
48
|
|
|
49
|
The [Promotion data model](/references/promotion/models/Promotion) has an `is_tax_inclusive` property that determines whether the promotion is tax-inclusive. |
|
50
|
|
|
51
|
If `is_tax_inclusive` is disabled (which is the default), the promotion's discount amount will be applied as-is to the cart, before taxes are calculated. See an example in the [Tax-Exclusive Promotion Example](#tax-exclusive-promotion-example) section. |
|
52
|
|
|
53
|
If `is_tax_inclusive` is enabled, the promotion's discount amount will first be reduced by the calculated tax amount (based on the [tax region's rate](../../tax/tax-region/page.mdx)). The reduced discount amount is then applied to the cart total. See an example in the [Tax-Inclusive Promotion Example](#tax-inclusive-promotion-example) section. |
|
54
|
|
|
55
|
--- |
|
56
|
|
|
57
|
## How to Set a Promotion as Tax-Inclusive |
|
58
|
|
|
59
|
<Note title="Looking for no-code approach?"> |
|
60
|
|
|
61
|
You can enable tax-inclusiveness for a promotion when [creating it in the Medusa Admin](!user-guide!/promotions/create). |
|
62
|
|
|
63
|
</Note> |
|
64
|
|
|
65
|
You can set the `is_tax_inclusive` property when creating a promotion by using either the [Promotion workflows](../workflows/page.mdx) or the [Promotion Module's service](/references/promotion). |
|
66
|
|
|
67
|
<Note> |
|
68
|
|
|
69
|
For most use cases, it's recommended to use [workflows](!docs!/learn/fundamentals/workflows) instead of directly using the module's service, as they implement the necessary rollback mechanisms in case of errors. |
|
70
|
|
|
71
|
</Note> |
|
72
|
|
|
73
|
For example, if you're creating a promotion with the [createPromotionsWorkflow](/references/medusa-workflows/createPromotionsWorkflow) in an API route: |
|
74
|
|
|
75
|
```ts highlights={[["17"]]} |
|
76
|
import type { |
|
77
|
MedusaRequest, |
|
78
|
MedusaResponse, |
|
79
|
} from "@medusajs/framework/http" |
|
80
|
import { createPromotionsWorkflow } from "@medusajs/medusa/core-flows" |
|
81
|
|
|
82
|
export async function POST( |
|
83
|
req: MedusaRequest, |
|
84
|
res: MedusaResponse |
|
85
|
) { |
|
86
|
const { result } = await createPromotionsWorkflow(req.scope) |
|
87
|
.run({ |
|
88
|
input: { |
|
89
|
promotionsData: [{ |
|
90
|
code: "10OFF", |
|
91
|
// ... |
|
92
|
is_tax_inclusive: true, |
|
93
|
}], |
|
94
|
}, |
|
95
|
}) |
|
96
|
|
|
97
|
res.send(result) |
|
98
|
} |
|
99
|
``` |
|
100
|
|
|
101
|
In the above example, you set the `is_tax_inclusive` property to `true` when creating the promotion, making it tax-inclusive. |
|
102
|
|
|
103
|
### Updating a Promotion's Tax-Inclusiveness |
|
104
|
|
|
105
|
A promotion's tax-inclusiveness cannot be updated after it has been created. If you need to change a promotion's tax-inclusiveness, you must delete the existing promotion and create a new one with the desired `is_tax_inclusive` value. |
|
106
|
|
|
107
|
--- |
|
108
|
|
|
109
|
## Tax-Inclusiveness Examples |
|
110
|
|
|
111
|
The following sections provide examples of how tax-inclusive promotions work in different scenarios, including both tax-exclusive and tax-inclusive promotions. |
|
112
|
|
|
113
|
These examples will help you understand how tax-inclusive promotions affect the cart total, allowing you to decide when to use them effectively. |
|
114
|
|
|
115
|
### Tax-Exclusive Promotion Example |
|
116
|
|
|
117
|
Consider the following scenario: |
|
118
|
|
|
119
|
- A tax-exclusive promotion gives a `$10` discount on the cart's total. |
|
120
|
- The cart's tax region has a `25%` tax rate. |
|
121
|
- The cart total before applying the promotion is `$100`. |
|
122
|
- [The prices in the cart's tax region are tax-exclusive](../../pricing/tax-inclusive-pricing/page.mdx). |
|
123
|
|
|
124
|
The result: |
|
125
|
|
|
126
|
1. Apply `$10` discount to cart total: `$100` - `$10` = `$90` |
|
127
|
2. Calculate tax on discounted total: `$90` x `25%` = `$22.50` |
|
128
|
3. Final total: `$90` + `$22.50` = `$112.50` |
|
129
|
|
|
130
|
### Tax-Inclusive Promotion Example |
|
131
|
|
|
132
|
Consider the following scenario: |
|
133
|
|
|
134
|
- A tax-inclusive promotion gives a `$10` discount on the cart's total. |
|
135
|
- The cart's tax region has a `25%` tax rate. |
|
136
|
- The cart total before applying the promotion is `$100`. |
|
137
|
- [The prices in the cart's tax region are tax-exclusive](../../pricing/tax-inclusive-pricing/page.mdx). |
|
138
|
|
|
139
|
The result: |
|
140
|
|
|
141
|
1. Calculate actual discount (removing tax): `$10` ÷ `1.25` = `$8` |
|
142
|
2. Apply discount to cart total: `$100` - `$8` = `$92` |
|
143
|
3. Calculate tax on discounted total: `$92` x `25%` = `$23` |
|
144
|
4. Final total: `$92` + `$23` = `$115` |
|
145
|
|
|
146
|
### Tax-Inclusive Promotions with Tax-Inclusive Prices |
|
147
|
|
|
148
|
Consider the following scenario: |
|
149
|
|
|
150
|
- A tax-inclusive promotion gives a `$10` discount on the cart's total. |
|
151
|
- The cart's tax region has a `25%` tax rate. |
|
152
|
- The cart total before applying the promotion is `$100`. |
|
153
|
- [The prices in the cart's tax region are tax-inclusive](../../pricing/tax-inclusive-pricing/page.mdx). |
|
154
|
|
|
155
|
The result: |
|
156
|
|
|
157
|
1. Calculate actual discount (removing tax): `$10` ÷ `1.25` = `$8` |
|
158
|
2. Calculate cart total without tax: `$100` ÷ `1.25` = `$80` |
|
159
|
3. Apply discount to cart total without tax: `$80` - `$8` = `$72` |
|
160
|
4. Add tax back to total: `$72` x `1.25` = `$90` |
|
161
|
|
|
162
|
The final total is `$90`, which correctly applies both the tax-inclusive promotion and tax-inclusive pricing. |