# Reduce Item's Discount

<figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2FPa9iWesrEE4I7Gex5liZ%2FReduce%20discount.png?alt=media&#x26;token=b02a46d9-00cd-4375-af45-ff0daf860426" alt=""><figcaption></figcaption></figure>

The "Reduce Item's Discount" is a macro that runs as an action of the [*Rules Engine*](https://docs.linnworks.com/articles/#!documentation/rules-engine)*.* This macro allows for the manual reduction of discounts by a specified value provided by the client. This macro facilitates the modification of discounts for items in the item line of order with a 100% discount applied.

This guide provides a step-by-step explanation of how to install and set up the macro in Linnworks.

### Start using the macro&#x20;

There are three steps you need to complete to start using the macro:

1. Install the application.
   * Go to *Apps > Application Store >* Reduce Item's Discount *>* click Install and follow the on-screen instructions until the installation is complete.
2. Configure the macro.
3. Configure the rule in the *Rules Engine* screen.

#### Configure the macro&#x20;

Once the Reduce Item's Discount app is installed:

1. Go to *Apps > Macro Configuration* and click  <mark style="color:purple;">+ Add new configuration.</mark><br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2FGgJsmHiTTPHpw9f35x97%2FDISC%201.PNG?alt=media&#x26;token=1ca5da59-b21c-4087-867a-b28ff91a3f2c" alt=""><figcaption></figcaption></figure>
2. Select the *Reduce Item's Discount* macro and click  <mark style="color:purple;">Create Configuration.</mark><br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2FFglM8P6xQqBnIWYN4juf%2FDISC%202.PNG?alt=media&#x26;token=e424d796-2243-405b-96ed-2b71a9afdfe6" alt=""><figcaption></figcaption></figure>
3. In the *Macro Configuration* screen, specify the below details and click *Save*:<br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2FL34vSaNtNYl5Rq9iavWF%2FDISC%203.PNG?alt=media&#x26;token=9323d0c4-efbf-4df5-8be0-8d2b2566c974" alt=""><figcaption></figcaption></figure>
4. Make sure to enable the macro to continue with the *Rules Engine* configuration.<br>

   <figure><img src="https://2079576606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFRkrZGowwT8Xbb5HKclZ%2Fuploads%2FhAHInfj6UA5H8AIoIWea%2FScreenshot%202024-02-16%20232940.png?alt=media&#x26;token=32d78407-2403-4251-ae4c-c938aa53dac3" alt=""><figcaption></figcaption></figure>

#### Functionality

1. **Discount Application:**
   * Iterates through specified orders and evaluates each order item's value.
   * Applies a discount to order items with a value of zero and a 100% discount already applied.
2. **Discount Calculation:**
   * Calculates the discount value based on the provided discount percentage.
3. **Order Item Update:**
   * Updates order items with the newly applied discounts to reflect the changes in pricing.

#### Usage

1. **Input Parameters:**
   * `OrderIds`: Array of order IDs to process.
   * `discountValue`: The discount percentage to apply to order items with a value of zero.
2. **Execution:**
   * Call the macro with the desired order IDs and discount value to initiate the discount application process.
3. **Outcome:**
   * The macro evaluates each order and applies discounts to qualifying order items as specified by the provided parameters.
   * Order items with a value of zero and a 100% discount applied are updated with the new discount value.
