> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.upsellplus.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Identifying the correct event listener that triggers the add to cart submit button

This guide will instruct you and illustrate how to identify the correct event listener and script you have to use to place the **init code**,  `upsellplusapp.init_drawer_offer(); ` appropriately:

1. On the product page, inspect (`Ctrl + Shift + I` or `⌘ Cmd +  Shift + C`) the 'add to cart' button and click on the ''**Event Listeners**'' tab:




![Finding the Event Listener Tab](https://storage.crisp.chat/users/helpdesk/website/abfa0cd47f75e80/event-listener-step-1_qfrrkx.gif)
![Event Listeners tab](https://storage.crisp.chat/users/helpdesk/website/abfa0cd47f75e80/image_1eu6tac.png)

2. Click on the **Submit** toggle to find the correct script. The key is to look for one file that ends with **.js**. For example, this file could be: **product-form.js**, **theme.js** or **theme-editor.js**

![Finding the file that contains the script](https://storage.crisp.chat/users/helpdesk/website/abfa0cd47f75e80/event-listener-step-2_12qzhj2.gif)

![When you hover over the 'form', the section that is being inspected will be highlighted. In this case, the Add to Cart button](https://storage.crisp.chat/users/helpdesk/website/abfa0cd47f75e80/screenshot-2023-08-07-at-12015_mz0lo5.png)

3. After you have identified the file that contains the script, you would want to click on the blue hyperlink that will take you to the **Source** tab which will show you the code that targets the Add to Cart button:


![Code that targets the 'Add to Cart' button](https://storage.crisp.chat/users/helpdesk/website/abfa0cd47f75e80/event-listener-step-3_1t9ygeg.gif)

4. Go to your Store's Admin page and look for the theme you'd like to edit the code for. (**We recommend having a backup of your original theme in case you need to revert the changes by either downloading the theme code or duplicating the live version of the theme**). When you are editing the code, look for the correct file, which in this case it is the  **product-form.js** located under the 'Assets' folder.

Add the `upsellplusapp.init_drawer_offer(); ` code where the cart should be updated. In this case, it belongs on line 59 as you can see in the example below:

![Final Step](https://storage.crisp.chat/users/helpdesk/website/abfa0cd47f75e80/screenshot-2023-08-07-at-12235_h0urec.png)