OpenCart's Theme Editor lets you change your store's templates right from the admin, and adding the Yaplet code to the footer template puts the chat on every page. You copy one block of code from Yaplet, paste it into the footer, and the chat button appears in your store. You don't need an extension or FTP access.
These steps are for OpenCart 4.1 and later. OpenCart 4.0 and 3.x have a different Theme Editor screen; their steps are at the end of this article.
1. Copy your Yaplet code
In the Yaplet dashboard's left menu, go to Brand → (your brand) → Chat widget → Install. If the tab asks where your website runs, choose Other website. Copy the code with the copy button on the code block.
The footer template is HTML, so the code must sit between a <script> line and a </script> line. With Other website chosen, the code already has these lines. If the tab didn't ask, the code is plain JavaScript that starts with !function (Yaplet, and you add the lines in step 3.
2. Open the footer template
- In your OpenCart admin, go to Design → Theme Editor. If common/footer is already in the list, edit that entry instead of adding a new one, and continue with step 3.
- Click the Add New button (the plus sign).
- For Store, choose Default or the store where you want the chat.
- In Choose Template, select common/footer. The editor loads the footer's current code.
3. Add the Yaplet code
- Scroll to the end of the code and find the line
</body></html>. Leave the rest of the code as it is: what you save here replaces the whole footer template. - Start a new line just above
</body></html>. - Paste the Yaplet code on the new line. It must start with a
<script>line and end with a</script>line. If what you copied starts with!function (Yapletinstead, type<script>on a new line before it and</script>on a new line after it. - Switch Status on.
- Click Save (the floppy-disk button at the top).
4. Check your store
Open your store in a new browser tab and reload the page with Ctrl+F5. The Yaplet chat button appears in the bottom-right corner. Click it to check that the chat opens.
For a full checklist, see Verify your installation.
OpenCart 4.0 and 3.x
Go to Design → Theme Editor and pick your store under Choose your store. Under Choose a template, open the common folder and click footer.twig. Add the code on a new line above </body></html> the same way as in step 3, then click Save.
If the chat doesn't appear
- The footer override is switched off. A switched-off entry looks grayed out in the Theme Editor list. Edit it, switch Status on, and save.
- You chose a different store. An entry only changes the store selected in it. If you run several stores, add the code for each one.
- The code shows up as text at the bottom of your pages. The
<script>tags are missing. Edit the footer, type<script>on a new line before the code and</script>on a new line after it, and save. - Your store shows a blank page or an error after saving. Part of the footer template changed by accident. Edit the entry and switch Status off to bring back the original footer, then try again.
- Your store uses a theme from another developer. The theme may use its own footer template, so the change has no effect. Ask the theme's developer where to add a script.
- Your browser shows an old copy of the page. Reload with Ctrl+F5, or open the store in a private browser window.
What's next
To see what the code does and where your widget ID is, read Install Yaplet.