← All articles
June 24, 2026

How to Auto-Import Supplier Products to OpenCart or WooCommerce

Manually copying products from your supplier's price list every week wastes hours. Here's how to automate product imports into OpenCart or WooCommerce from CSV, XML, or supplier APIs.

The Manual Import Problem

Most e-commerce store owners spend hours every week doing the same thing: download the supplier's price list, find what changed, update products in the admin panel. Sometimes it's 50 products. Sometimes it's 5,000.

This is exactly the kind of repetitive task that's worth automating. Once set up, it runs itself.

What You Need to Know First

Before building anything, answer these questions:

  1. What format does your supplier provide? — CSV, Excel, XML, JSON API, FTP?
  2. How often does it update? — Daily? Weekly? Real-time?
  3. What needs to update? — Prices only? Stock levels? New products? Descriptions?
  4. How do you match products? — SKU? Barcode? Product name?

The answers determine what you build.

Case 1: Supplier Provides a CSV/Excel File

This is the most common case. The supplier emails you a file or you download it from their portal.

Step 1: Parse the File

import pandas as pd

df = pd.read_csv("supplier_prices.csv", encoding="utf-8")
# or for Excel:
# df = pd.read_excel("supplier_prices.xlsx")

print(df.columns.tolist())
# ['SKU', 'Name', 'Price', 'Stock', 'Category']

Step 2: Match to Your Store Products

Your store has its own product IDs. You need to map supplier SKUs to your internal IDs:

import sqlite3

# Build a lookup: supplier_sku -> your_product_id
conn = sqlite3.connect("your_store.db")  # or use WooCommerce/OpenCart DB
sku_map = dict(conn.execute(
    "SELECT sku, product_id FROM products"
).fetchall())

for _, row in df.iterrows():
    product_id = sku_map.get(row["SKU"])
    if product_id:
        update_product(product_id, price=row["Price"], stock=row["Stock"])
    else:
        # New product from supplier — create it or log for manual review
        log_new_product(row)

Step 3: Update Via API or Database

WooCommerce REST API (recommended — no direct DB access needed):

import requests

def update_woo_product(product_id, price, stock, api_url, key, secret):
    r = requests.put(
        f"{api_url}/wp-json/wc/v3/products/{product_id}",
        auth=(key, secret),
        json={
            "regular_price": str(price),
            "stock_quantity": int(stock),
            "manage_stock": True,
        }
    )
    return r.json()

OpenCart — easiest via direct database update:

import pymysql

def update_opencart_price(product_id, price, stock, db):
    with db.cursor() as cur:
        cur.execute(
            "UPDATE oc_product SET price = %s, quantity = %s WHERE product_id = %s",
            (price, stock, product_id)
        )
    db.commit()

Case 2: Supplier Provides an XML Feed

Common with automotive parts suppliers and some wholesale platforms.

import xml.etree.ElementTree as ET

tree = ET.parse("supplier_catalog.xml")
root = tree.getroot()

for product in root.findall(".//product"):
    sku = product.find("sku").text
    price = float(product.find("price").text)
    stock = int(product.find("quantity").text)
    update_product_by_sku(sku, price, stock)

For large XML files (100MB+), use iterative parsing:

for event, elem in ET.iterparse("large_catalog.xml", events=("end",)):
    if elem.tag == "product":
        process_product(elem)
        elem.clear()  # free memory

Case 3: Supplier Has an API

The cleanest option. Get API credentials from your supplier and hit their endpoint:

import requests

def fetch_supplier_stock(api_key):
    r = requests.get(
        "https://supplier.com/api/v1/products",
        headers={"Authorization": f"Bearer {api_key}"},
        params={"updated_since": "2025-01-01"}
    )
    return r.json()["products"]

Automating the Schedule

Run the import on a VPS with cron:

# Update prices every night at 2am
0 2 * * * /usr/bin/python3 /home/user/importer/run.py >> /home/user/importer/import.log 2>&1

Or for suppliers that update in real-time, poll every few hours:

0 */4 * * * /usr/bin/python3 /home/user/importer/run.py

Handling Errors and Edge Cases

A good import script handles these:

  • Encoding issues — supplier CSVs are often Windows-1251 or Latin-1: pd.read_csv(f, encoding="cp1251")
  • Price format — "1.234,56" (European) vs "1,234.56" (US): clean before parsing
  • Missing products — log new supplier SKUs that don't exist in your store yet
  • Stock going to zero — decide: hide the product or show "out of stock"?
  • Import failures — wrap in try/except, send a Telegram alert if the import fails
import telebot

bot = telebot.TeleBot("YOUR_TOKEN")
ADMIN_CHAT = 123456789

def notify(msg):
    bot.send_message(ADMIN_CHAT, msg)

try:
    count = run_import()
    notify(f"✅ Import done: {count} products updated")
except Exception as e:
    notify(f"❌ Import failed: {e}")

What This Usually Costs

A basic price/stock sync script: $100–150 — reads a CSV or XML, updates prices and stock, runs daily via cron.

With new product creation, image download, category mapping: $200–350 — more logic for matching categories, handling new products, downloading and resizing images.

Multi-supplier with conflict resolution: $300–500 — combining feeds from several suppliers, picking the best price, handling different SKU formats.

If you're spending hours a week on manual imports, tell me your supplier format and store platform — I'll quote you a specific number.

Need help with this?

DevCev Digital specialises in exactly this kind of work. Tell us what you need — we'll respond within a few hours.

Get free diagnostic →Automation & Web Scraping
← Back to blogGot a project? Let's talk →