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