# Magento 2

### Instructions for configuring and installing the module. <a href="#instrukciya-po-nastroike-i-ustanovke-modulya" id="instrukciya-po-nastroike-i-ustanovke-modulya"></a>

1.Download the [module archive](https://github.com/unitpay/magento2/archive/main.zip) and upload it to the site root.<br>

2\. In the shell from the site root to run the command php bin/magento setup:upgrade to install module<br>

3\. php bin/magento setup:di:compile for compiling configuration files<br>

4\. Go to the admin panel. Stores -> Configuration

<div align="left"><img src="https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxOI9jiZuBD2fxW-5n%2Fimage2.png?alt=media&#x26;token=c6e0c746-8779-4f47-9a5d-e21b9fab06f6" alt=""></div>

5\. In the left menu, select Sales -> Payment Methods

<div align="left"><img src="https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxOXwjbMdjFoDzH8RO%2Fimage7.png?alt=media&#x26;token=cdb86e38-90d0-46f6-81b7-76075536a827" alt=""></div>

6\. Find the unitpay module and set the settings Domain (**unitpay.ru**), Public Key, Secret Key (you can take it in the project settings in your personal account Unitpay)

<div align="left"><img src="https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxOelndkA2xsfqEQgo%2Fimage6.png?alt=media&#x26;token=77b0e2a6-43f0-48ff-b010-8a1fd2bf4add" alt=""></div>

7\. VAT can be set for each product. Catalogs -> Products, click on the product, choose it Tax Class

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxST4vb0VpxFEsc76e%2Fimage1.png?alt=media\&token=a3839490-8b9e-4467-a582-69b8d1e26fb0)

Tax Class is configured in Stores -> Tax Rules

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxSYF2CUryqr7Tk0wd%2Fimage5.png?alt=media\&token=0c6a11dc-018e-40aa-8da2-8e7e240c1330)

Coverage area in Stores -> Tax Zones and Rates

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxSe4gepfuRM4kKQfz%2Fimage3.png?alt=media\&token=5a1879a5-0ac1-48b4-b9d3-c17ce23d3e6f)

8\. By default, delivery is valid for each product (3 products = triple the cost of delivery). To configure this, go to Stores -> Configuration.Then in the sales drop down list Sales we look for Shipping methods

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MNxKrYcEvOrX9GOhsE6%2F-MNxSOlEewBSrMHlgiqZ%2Fimage4.png?alt=media\&token=c48f8b09-cdff-4852-b592-3c6814507c66)

9\. Enter in your personal account Unitpay.ru in the project settings the payment handler. according to the template: http\://\<your\_site\_name>/unitpay/payment/callback

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M9Y_k8Gr-WxeECFRelw-887967055%2Fuploads%2FWoG38Ck9ohLZmUkHfhp7%2Fimage.png?alt=media\&token=d0b145b2-e43b-49e8-ab10-ddca41868e22)

10\. Promotional codes are also available. To set them up, go to the Marketing - Promotion - Cart Price Rules - Add new rule.

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MflSpINGI-XUSEFdL5u%2F-MflWR4yIMa6pBMo--oW%2Fimage.png?alt=media\&token=bc8d175d-9788-446e-a4d3-759572c8ec6e)

1\) Rule name - **it's not the name of the promocode**;\
2\) Websites - using zone (can be set for certain sections of the site);\
3\) Customer groups - user groups for which this promo code is opened;\
4\) Coupon - choose Specific coupon;\
5\) Uses per Customer - the maximum number of promocode's uses for one authorized customer;\
6\) Uses per Coupon - the total maximum number of this promocode's uses;

Then open the Actions tab and set the actions for the promocode:

![](https://244174165-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M9Y_k8Gr-WxeECFRelw%2F-MflSpINGI-XUSEFdL5u%2F-MflZgLHMK9KM5A4q5_Q%2Fimage.png?alt=media\&token=f5d35b03-7227-41ab-9d12-f29e3a922552)

Promocodes' options:

1. **Discount for the whole cart in %**

   Apply - Percent of product price discount, Discount Amount - discount amount,%
2. **Discount for the whole cart for a certain amount**

   Apply - Fixed amount discount for whole cart, Discount Amount - discount amount
3. **Discount for each item from the cart for a certain amount**

   Apply - Fixed amount discount, Discount Amount - discount amount

   Note: the discount on the item must be less than the cost of the product from the catalog, otherwise the promocode will work with an error - you cannot provide products with a zero amount.
4. Also, for each promo code, you can specify **free shipping**

   Free shipping - Select - For matching items only
