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