How to Connect WooCommerce with Odoo 18 Using Webhooks for Real
In the modern digital commerce landscape, ensuring smooth communication between business systems is vital for maintaining data integrity and improving operational workflows. One efficient way to establish real-time interaction between platforms is by using webhooks.
In this guide, we’ll walk through the process of integrating WooCommerce with Odoo Implementation 18 via webhooks to receive immediate updates on events like product creation and order placements—with no delay and no need for repetitive API polling.
🚀 Why Choose Webhooks?
Webhooks are automated HTTP callbacks triggered when specific events occur in an application. Unlike traditional APIs that require continuous polling to check for updates, webhooks push data instantly when something changes.
Example Use Case:
- A new product is created in WooCommerce.
- WooCommerce automatically sends an HTTP POST request to a designated URL in Odoo.
- Odoo processes the incoming data and creates the product entry without manual input.
This setup ensures your Odoo system stays perfectly in sync with your WooCommerce store, effortlessly.
🛠️ Step 1: Create a Webhook Receiver in Odoo 18
To accept incoming data from WooCommerce, we first need to set up a custom HTTP controller in Odoo 18.
Sample Python Controller Code:
@http.route('/product/create', type='json', auth="none", csrf=False)
def create_product(self, **kw):
"""
Handle the product creation webhook.
"""
if not kw:
try:
response = request.get_json_data()
print(response, "The Product Data")
_logger.info("PRODUCT CREATE WEBHOOK call for this product: %s", response)
except Exception as e:
_logger.error("Error while processing PRODUCT CREATE WEBHOOK: %s", str(e))
return True
🔒 Security Tip: Using
auth="none"
makes the route public. Always secure it in production using methods like IP whitelisting or secret tokens.
⚙️ Step 2: Configure Webhook in WooCommerce
- Log into your WooCommerce Admin Panel.
- Navigate to WooCommerce > Settings > Advanced > Webhooks.
- Click “Add Webhook.”
- Fill in the webhook fields:
- Name: Product Creation Webhook
- Status: Active
- Topic: Product Created
- Delivery URL:
https://your-odoo-domain.com/product/create
- Secret: (Add a secret key from your WooCommerce instance.)
- Save the webhook.
Once saved, WooCommerce will automatically notify Odoo when a new product is added.
🔍 Step 3: Test Your Integration
To verify everything is working correctly:
- Create a new product in WooCommerce.
- The webhook will immediately hit the Odoo controller endpoint.
- Check your Odoo logs or database to confirm the product has been created.
📦 Sample Webhook Payload from WooCommerce
Below is a simplified example of what WooCommerce sends to Odoo:
{
"id": 1524,
"name": "Test Product",
"sku": "TEST-SKU-001",
"price": "25.00",
"regular_price": "30.00",
"type": "simple",
"categories": [
{
"id": 15,
"name": "Uncategorized"
}
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2025/05/sample.jpg"
}
]
}
🛡️ Key Considerations for Webhook Integration
1. Your Odoo Server Must Be Live & HTTPS-Enabled
External platforms like WooCommerce require
- A publicly accessible server (no localhost/private IPs)
- A valid SSL certificate with an HTTPS URL
💡 For local development, tools like ngrok can expose your local server via HTTPS.
2. Secure Your Webhook Endpoint
Since the Odoo route is open to the public (auth="none"
), always implement additional layers of security:
- Use secret tokens in headers or URLs
- Validate webhook signatures if supported
- Implement IP whitelisting to restrict access
3. Logging and Error Handling
Always use try/except
blocks to manage unexpected errors. Proper logging ensures you can trace and fix issues efficiently.
✅ Conclusion
By leveraging webhooks with Odoo 18, you can automate real-time integration with WooCommerce and other platforms without the drawbacks of API polling. Whether you’re syncing products, orders, or customers, this method provides a scalable, event-driven architecture that enhances both speed and accuracy in your Odoo implementation.
Book an implementation consultant today.