Hi @hahalfons , thanks for reaching out to the Shopify Community.
At this time people cannot access the coding of the Shopify Inbox app and make any changes. We hope to provide more customization in the future with the Shopify Inbox app.
If in liquid-file, use tag around JavaScript code.
function observeChatInbox(){
// get inbox element
const inboxElement = document.querySelector('#ShopifyChat');
// change title hardcoded
inboxElement.title = "Chat";
// alternative using translations: inboxElement.title = '{{ "path.to.your.translation.field" | t }}';
// get shadow DOM
const shadowDOM = inboxElement.shadowRoot; // Zugriff auf den Shadow DOM
// set config for observer
let config = { attributes: false, childList: true, subtree: true };
// Callback function to execute when mutations are observed
let callback = function (mutationsList, observer) {
// walk through mutations
for (const mutation of mutationsList) {
// if mutation target has an h2 element inside a store-info-heading
if(mutation.target && (storeInfoHeading = mutation.target.querySelector('.store-info-heading h2')) != null){
// change it
storeInfoHeading.innerHTML = 'Other heading';
}
}
};
// Create an observer instance linked to the callback function
let observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
if (shadowDOM !== null) {
observer.observe(shadowDOM, config);
}
}
// call observer when DOM is loaded
document.addEventListener("DOMContentLoaded", () => {
observeChatInbox();
});
Explanation: I checked the DOM tree and looked at the inbox element. It is implemented as shadow-root element, so it has its own tree and cannot be influenced by CSS etc. from outside. To access elements inside it, the shadow root needs to be accessed explicetly. However, in my case the inbox element is defined “open” (maybe it’s not with all shopify plans?), so I can manipulate it with JavaScript. You can check if it’s open with developer tools in your browser → inspect the chat element:
Hey buddy, my code is “open” just like yours. I tried implemeting the code but not sure which part of the code has to be altered to fit the wording I want and how.
How should the code look like if I want it to say “Get in touch with us” for example? I’d highly appreciate your assistance!
I appreciate your reply. Just tried using the code in my theme.liquid file with opening and closing tag but without luck, pretty much nothing changed. Am I doing the right thing..?