---
title: Overview
slug: template-js/modify-response
docTags: 
createdAt: 2022-06-02T13:18:36.000Z
---

# Modify Response

To modify a search response, the incoming response object is intercepted and any of the available datapoints can be manipulated as needed *prior* to being sent to the UI templates.

There are two steps:

1. *Intercept* the incoming response object
2. *Identify the data object* to be modified



## Intercept the Response Object

Any of the product attributes are available to be modified as needed or otherwise inject any custom values.

Use the `klevu.modifyResponse` function to intercept the response data.

:::BlockQuote
**klevu.modifyResponse**("\<scope>", "\<callback>");
:::



## Identify the Data Object

The simplest way to get acquainted with the available data is to use **console.log** and review the output.

:::BlockQuote
klevu.modifyResponse("landing", function(data, scope)\{
&#x20;     **console.log('klevu.modifyResponse', data);**
&#x20;});
:::

For example, the following snippet loops through **each record in the productList result** and outputs the `product` object to the browser's developer **console.log**

:::BlockQuote
klevu.modifyResponse("all", function(data, scope)\{
&#x20; klevu.each(**data.template.query.productList.result**, function(indx, product)
&#x20; \{&#xA;**&#x20;    console.log('Klevu Response Product ' + indx, product);**
&#x20; });
});
:::



## Determining Scope

**Note** that each `klevu.modifyResponse` function requires definition within the corresponding `scope` of the override. We will chart these below.

| Scope      | Description                                               |
| ---------- | --------------------------------------------------------- |
| all        | Applies to all scope modules                              |
| quick      | QuickSearch module                                        |
| landing    | SRLP module                                               |
| catnav     | Category module                                           |
| full\_page | Both SRLP and Category modules (same as "landing,catnav") |

:::hint{type="success"}
Multiple `klevu.modifyResponse` functions can be applied in the same or mixed scope.
:::



## Examples

Please see the Modify Response [Examples](docId\:Y_x07x1PW9DOw-ThixCdL) section for details of common uses.



.
