Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
excluding_tax_apply_tax_after_discount.php
Go to the documentation of this file.
1 <?php
9 
10 $taxCalculationData['excluding_tax_apply_tax_after_discount'] = [
11  'config_data' => [
12  SetupUtil::CONFIG_OVERRIDES => [
13  Config::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT => 1,
14  Config::CONFIG_XML_PATH_SHIPPING_TAX_CLASS => SetupUtil::SHIPPING_TAX_CLASS,
15  ],
16  SetupUtil::TAX_RATE_OVERRIDES => [
17  SetupUtil::TAX_RATE_TX => 20,
18  ],
19  SetupUtil::TAX_RULE_OVERRIDES => [
20  [
21  //tax rule for product
22  'code' => 'Product Tax Rule',
23  'product_tax_class_ids' => [SetupUtil::PRODUCT_TAX_CLASS_1],
24  ],
25  [
26  //tax rule for shipping
27  'code' => 'Shipping Tax Rule',
28  'product_tax_class_ids' => [SetupUtil::SHIPPING_TAX_CLASS],
29  'tax_rate_ids' => [SetupUtil::TAX_RATE_SHIPPING],
30  ],
31  ],
32  ],
33  'quote_data' => [
34  'billing_address' => [
35  'region_id' => SetupUtil::REGION_TX,
36  ],
37  'shipping_address' => [
38  'region_id' => SetupUtil::REGION_TX,
39  ],
40  'items' => [
41  [
42  'sku' => 'simple1',
43  'price' => 10,
44  'qty' => 2,
45  ],
46  ],
47  'shipping_method' => 'flatrate_flatrate',
48  'shopping_cart_rules' => [
49  [
50  'discount_amount' => 50,
51  ],
52  ],
53  ],
54  'expected_results' => [
55  'address_data' => [
56  'subtotal' => 20,
57  'base_subtotal' => 20,
58  'subtotal_incl_tax' => 24,
59  'base_subtotal_incl_tax' => 24,
60  'tax_amount' => 2.75,
61  'base_tax_amount' => 2.75,
62  'shipping_amount' => 10,
63  'base_shipping_amount' => 10,
64  'shipping_incl_tax' => 10.75,
65  'base_shipping_incl_tax' => 10.75,
66  'shipping_tax_amount' => 0.75,
67  'base_shipping_tax_amount' => 0.75,
68  'discount_amount' => -10,
69  'base_discount_amount' => -10,
70  'discount_tax_compensation_amount' => 0,
71  'base_discount_tax_compensation_amount' => 0,
72  'shipping_discount_tax_compensation_amount' => 0,
73  'base_shipping_discount_tax_compensation_amount' => 0,
74  'grand_total' => 22.75,
75  'base_grand_total' => 22.75,
76  'applied_taxes' => [
77  SetupUtil::TAX_RATE_TX => [
78  'percent' => 20,
79  'amount' => 2,
80  'base_amount' => 2,
81  'rates' => [
82  [
83  'code' => SetupUtil::TAX_RATE_TX,
84  'title' => SetupUtil::TAX_RATE_TX,
85  'percent' => 20,
86  ],
87  ],
88  ],
89  SetupUtil::TAX_RATE_SHIPPING => [
90  'percent' => 7.5,
91  'amount' => 0.75,
92  'base_amount' => 0.75,
93  'rates' => [
94  [
95  'code' => SetupUtil::TAX_RATE_SHIPPING,
96  'title' => SetupUtil::TAX_RATE_SHIPPING,
97  'percent' => 7.5,
98  ],
99  ],
100  ],
101  ],
102  ],
103  'items_data' => [
104  'simple1' => [
105  'row_total' => 20,
106  'base_row_total' => 20,
107  'tax_percent' => 20,
108  'price' => 10,
109  'base_price' => 10,
110  'price_incl_tax' => 12,
111  'base_price_incl_tax' => 12,
112  'row_total_incl_tax' => 24,
113  'base_row_total_incl_tax' => 24,
114  'tax_amount' => 2,
115  'base_tax_amount' => 2,
116  'discount_amount' => 10,
117  'base_discount_amount' => 10,
118  'discount_percent' => 50,
119  'discount_tax_compensation_amount' => 0,
120  'base_discount_tax_compensation_amount' => 0,
121  ],
122  ],
123  ],
124 ];
$taxCalculationData['excluding_tax_apply_tax_after_discount']