> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kibocommerce.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Return Rules

Return rules allow you to configure custom return policies that take into account whether a product is returnable, the maximum quantity that can be returned, and the return window within which an item can be returned. This can help reduce errors during the return process.

<Card title="Returns Concepts" icon="book-open" href="/concept-guides/returns-and-reverse-logistics" horizontal data-rec="concept-guide">
  Understand return processing and reverse logistics
</Card>

In addition to the UI detailed here, you can create and manage return rules with the [Return Rules API endpoints](/api-reference/returnrules/get-return-rules). The [Product Rules](/api-reference/productrules/create-product-rule) and [Customer Rules](/api-reference/accountrankingrule/create-customer-rule) APIs can also be used to manage supporting product and customer rules.

## Return Rule Criteria

Return rules are based on expressions called product and customer rules, at least one of which is required to create a return rule. These are made up of a set of conditions that can be used with logical operators like OR or AND, such as in a product rule of "Color = Blue AND Brand = Adidas" that would restrict the return rule to products that fit those conditions.

Product rules can be based on product type, code, variant, static category, attribute, and some other first class fields. For example, a product-based return rule could consider:

* Whether a specific product can be returned
* Whether products in a specific static category can be returned
* Whether a product with a certain attribute can be returned
* Whether a product with a certain product type can be returned
* The return window, or number of days after it was delivered to the shopper in which it is eligible for return

Customer rules can be based on either a customer account or customer segment. If neither is provided, the rule will apply to all customers and customer segments. For example, a customer-based return rule could consider:

* Whether a specific customer can return an item of that product, product type, static category, or attribute
* Whether customers in a customer segment can return an item of that product, product type, static category, or attribute

Return rules can also be configured to limit the quantity allowed in a return. A maximum quantity-based return rule can be provided only if an item is returnable. This considers:

* The maximum quantity of the specific product that can be returned
* The maximum quantity that can be returned by the customer or customer segment

## Return Rule Behavior

Returns are validated against the rules whenever one is initiated from the [Order Admin](/pages/initiate-a-return "Initiate a Return"), [Fulfiller UI](/pages/fulfiller-returns "Fulfiller Returns"), or My Account page on the storefront. The Order Admin's returnable item details will also display any quantity limit or return window that has been passed, and restrict the item from being selected for a return (though this can be overridden in the initiation process). If any return fails validation, an error will be displayed and it will not be created.

Return rule information will be reflected in the item-level data of [Shipment APIs](/api-overviews/openapi_fulfillment_overview), such as when creating or updating a shipment. The below `returnRuleInfo` object indicates whether the item is returnable and if so, any applicable return quantity limit or maximum return window. The API documentation will be updated with these fields soon.

```
"returnRuleInfo" {
   "isReturnable": boolean,
   "maxQty": integer,
   "maxDays": integer,
   "ruleCode": string
}
```

The [Get Order Returnable Items API](/api-reference/order/get-order-returnable-items) response includes an `isItemReturnable` flag on each order item that indicates whether it can be returned or not based on your return rules (including whether it is still within the allowed return window).

## Enable Return Rules

Contact [Kibo Support](https://help.kibocommerce.com/) to enable this feature.

The following behaviors allow [users](/pages/user-roles "User Roles") to view and update return rules. The Admin and SuperAdmin roles have these behaviors by default.

* Product Rule
  * Product Rule Read, Product Rule Create, Product Rule Update, Product Rule Delete
* Customer Rule
  * Customer Rule Read, Customer Rule Create, Customer Rule Update, Customer Rule Delete
* Return Rule
  * Return Rule Read, Return Rule Create, Return Rule Update, Return Rule Delete

## Configure Return Rules

To configure a return rule:

1. Go to **Main** > **Orders** > **Return** **Rules**.
2. Select a **Site** to view its existing rules.
3. Click **Create Return Rule** or click an existing rule in the table.
   * If you choose to create a new rule, clicking the button directly will create a rule for the current site. Expand the drop-down menu on the Create button to select a different site instead.
   * When creating return rules via this UI, a rule can only be applied to one site. If you want to assign a rule to multiple sites, create or update it via the [Rule APIs](/api-reference/returnrules/update-return-rule) instead.
4. Enter a **Code**. If not provided, the system will generate one automatically.
5. Enter a **Name**.
6. Enter an optional **Description**.<img src="https://mintcdn.com/kibocommerce-59e68a4a/tog-DCkJI91k_kKe/img/configure-return-rule.png?fit=max&auto=format&n=tog-DCkJI91k_kKe&q=85&s=06802820621ce6685a743781351f77e4" alt="An example return rule" width="669" height="745" data-path="img/configure-return-rule.png" />
7. Select or create at least one product rule or customer rule.
   * Creating or editing a rule will open an expression editor that you can view in Query, JSON, or Text format. Here you can define one or more conditions by entering a product property, logical operator, and value to compare the property against and grouping them as needed. Click **Preview** to view a list of records that would be impacted by the expression.<img src="https://mintcdn.com/kibocommerce-59e68a4a/yPPx2ALUR4FHFmVl/img/product-rule-expression-ca4cd5.png?fit=max&auto=format&n=yPPx2ALUR4FHFmVl&q=85&s=55246fdcb17be56b6e23bff53c744096" alt="The product rule expression editor" width="792" height="433" data-path="img/product-rule-expression-ca4cd5.png" />
   * Product and customer rules cannot be shared across any other rule features, such as [purchase limit rules](/pages/purchase-limit-rules "Purchase Limit Rules"). This means that only those that were created as part of return rules will be available here.
8. Check **Item is returnable** if applicable to validate that the item is returnable.
9. Enter the **Max Returnable Quantity** you want to allow per return.
10. Enter a **Return Window** as an integer to represent the number of days after an item completes fulfillment in which returns are accepted. Kibo advises including a buffer period to account for the time taken to deliver an item. For instance, if delivery generally takes 5 days after shipment fulfillment and you want to provide the shopper with a 30-day return window, you should enter a window of 35 days.
11. Click **Save**. Once a return rule is created, it is assigned the lowest rank. You can change this on the dashboard shown below.

## View Return Rules

This page at **Main** > **Orders** > **Return** **Rules** displays all existing rules and allows you to manage them with the below actions:

* Change the **Site** in the top left to view rules for a different site.
* Toggle the **Status** icon on a specific rule to activate or deactivate it.
* Expand the actions menu on a specific rule to **Edit** or **Delete** it.
* Check multiple rules and then use the **Actions** menu in the top right to delete, enable, or disable them.
* Edit the **Rank** of a rule or click and drag it to reorder them. When the rules are run, they will always be applied in order of the highest to lowest rank (with 1 being the highest rank).
  * Ranks are unique per rule across all sites in the master catalog. This means that if a rule is ranked #1 and only assigned to one site, then all other sites will not display a rule in the #1 rank position. If that rule is assigned to multiple sites, it will be ranked #1 on each assigned site and the sites it is not assigned to will not display a rule in the #1 position. If a rule needs to have a different rank on two different sites, then it should be created twice and a different unique rank should be assigned to each.
* Click **Test Rule** to open a sidebar and enter a product with a customer or customer segment. The system will evaluate which rule affects that case and display it with its returnable status and any maximum return quantity or return window, as well as a link to view or update the rule configurations.

<img src="https://mintcdn.com/kibocommerce-59e68a4a/RFia3SXPeyM44geJ/img/return-rules-dashboard.png?fit=max&auto=format&n=RFia3SXPeyM44geJ&q=85&s=cb4d80be8c5b2d258eca2ccd2e2fa915" alt="The return rules dashboard" width="1132" height="369" data-path="img/return-rules-dashboard.png" />
