# Customising core functionality

Say you want to customise what happens after a user clicks on "Add to bag" button, we allow you to perform your own action using a function. This function has a pre-defined name as declared by our developers and all you need to do is use that function and define what it should do.

## ✍️ Objective - Display success message after Add to bag button is clicked

The name of the function which needs to be defined in order for an action to be performed after Add to bag event is called **`afterAddToBagCall`**

The function accepts 2 parameters **`productUUID`** and **`skuUUID`**

So, let's define the function

```javascript
window.afterAddToBagCall = (productUUID, skuUUID) => {
    alert(`Add to bag button clicked`);
}
```

Let's add the above code snippet to our layout.js file. Once added, click on **Save & preview store** button.

<figure><img src="https://869317877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpxvKr8371wMxhqFS6hu%2Fuploads%2FHVTKvpLwdQYFX1ikQiHU%2FScreenshot%202023-04-03%20at%2021.38.59.png?alt=media&#x26;token=b05a2cbe-76aa-4791-a67b-16285669ed49" alt=""><figcaption></figcaption></figure>

On clicking the Add to bag (in this case Place in bag since we changed the text) button, we get a popup.

<figure><img src="https://869317877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpxvKr8371wMxhqFS6hu%2Fuploads%2FuiwtO5ebV6oZxg1gsuEX%2FScreenshot%202023-04-03%20at%2021.39.07.png?alt=media&#x26;token=f32545a7-ae1a-4a0f-9313-1676250fcbab" alt=""><figcaption></figcaption></figure>

Once you click on OK the message disappears and your product is added to cart, as seen in the picture below.

<figure><img src="https://869317877-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEpxvKr8371wMxhqFS6hu%2Fuploads%2FrZabru8cyfzvW14Emgt4%2FScreenshot%202023-04-03%20at%2021.39.52.png?alt=media&#x26;token=3b6142f8-9b34-4388-bc06-a50d306e82bb" alt=""><figcaption></figcaption></figure>

This is how you can customise this function to do changes as per your requirement.<br>

You can view list of all such custom [Dukaan Functions here](https://docs.mydukaan.io/dukaan-functions).
