Odoo's CMS is a powerful tool that lets users create and manage websites easily. However, there are times when you need to insert custom HTML code into the website. For example, you may need to insert a social media widget, a Google Map or a Google Analytics tracking code.
In this article, we will show you how to embed HTML code in the Odoo ERP CMS, using the addition of a WhatsApp button as an example, since it is one of the most requested use cases.
The WhatsApp button is a simple way for your website visitors to contact you through the instant messaging app.
Important disclaimer: the latest versions of Odoo already include, out of the box, the option to link WhatsApp to Odoo's public chat. However, we are doing this example by adding a WhatsApp button because it illustrates very well how to take advantage of Odoo's advanced Website editing options, and it will also be useful if you use older versions of Odoo.
Step 1: Add new styles with the CSS Code editor
The specific tutorial to complete this first step is explained in the video at the end of this post. In the CSS editor we must add this code:
.whatsapp {position:fixed;
width:60px;
height:60px;
bottom:40px;
right:40px;
background-color:#25d366;
color:#FFF;
border-radius:50px;
text-align:center;
font-size:30px;
z-index:100;
}
.whatsapp-icon {
margin-top:13px;
}
Step 2: Add HTML tag to the <Head> of your Odoo Website
The following code must be added to the <Head> section of your website.
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Test WhatsApp</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
Step 3: Add HTML tag to the <Body> of your Odoo Website
Finally, add the following HTML code to the <body> of your Odoo website so the WhatsApp button appears in the bottom right corner and stays visible while scrolling the page.
<a href="https://wa.me/51946377197?text=I%20would%20like%20to%20know%20the%20price%20of%20implementing%20the%20ERP" class="whatsapp" target="_blank"> <i class="fa fa-whatsapp whatsapp-icon"></i></a>Conclusions
It is very easy to customize your Odoo website and e-commerce using the code embed block (embed HTML). The following video shows how to follow the steps described in this post to create and add the WhatsApp button to your website.