# Changing text of Add to bag button

Say you want to update the text of **"Add to bag"** button to **"Place in bag"**.\
To replace this you need to go to the file that contains the text "Add to bag" and replace it with the new text.\
\
You can find the text in the file layout.html.\
In the file search for the text "Add to bag" and you'd find this code

<figure><img src="/files/iCIMnHE5tio7QLCTjHo0" alt=""><figcaption></figcaption></figure>

Line number 291 has Nunjucks code `DUKAAN_LANGUAGE.ADD_TO_BAG`\
It basically fetches the text equivalent for "Add to bag" from the variable DUKAAN\_LANGUAGE which contains a list of all texts as per the store language set.<br>

So, you can replace it directly with your text "Place in bag", and this is how the updated code would look like.

<figure><img src="/files/QRAvR7XbKkgBDmGxwYH7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You need to replace the text for all occurrences of "Add to bag" button in the layout.html file since this button is used in multiple places, make sure you don't miss out on any else you'll see the "Add to bag" text in some places and "Place in bag" button in the remaining.
{% endhint %}

Deploy the change to see it live on your preview and main store.

## Alternative using Javascript (Not recommended)

You can use query selectors to target the Add to Bag button and replace its text.\
Place this code snippet in the layout.js file and then deploy to see the changes live.

```javascript
const buttons = document.querySelectorAll('.without-cart-add-to-bag-button');

buttons.forEach(button => {
  button.textContent = 'Place in bag';
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mydukaan.io/code-snippets/changing-text-of-add-to-bag-button.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
