Issue Connecting ERPNext 14 to WooCommerce using Created API Keys


I’ve installed the WooCommerce connector on my ERPNext 14 instance. While I’m able to create API keys successfully on the WooCommerce site, I’ve encountered challenges when trying to use these keys for establishing a connection. Despite numerous attempts with different API keys, the connection remains unsuccessful. I’ve attached the error log below for reference:


If anyone has faced a similar issue or has suggestions on how to resolve it, I would greatly appreciate your guidance.

Thank you in advance for your assistance.


Hello, which woocommerce connector did you use

I used the WooCommerce connector app not the integrated one. I did manage to get it to authenticate but I cant sync. It seams to have problems with the shipping and tax table. I can post the error code when I get home later tonight.


Here is the error I keep getting. It always seems to be shipping and tax related.

Traceback (most recent call last):
  File "apps/woocommerceconnector/woocommerceconnector/", line 30, in sync_woocommerce_orders
    create_order(woocommerce_order, woocommerce_settings)
  File "apps/woocommerceconnector/woocommerceconnector/", line 164, in create_order
    so = create_sales_order(woocommerce_order, woocommerce_settings, company)
  File "apps/woocommerceconnector/woocommerceconnector/", line 211, in create_sales_order
    "taxes": get_order_taxes(woocommerce_order, woocommerce_settings),
  File "apps/woocommerceconnector/woocommerceconnector/", line 378, in get_order_taxes
    taxes = update_taxes_with_shipping_lines(taxes, woocommerce_order.get("shipping_lines"), woocommerce_settings)
  File "apps/woocommerceconnector/woocommerceconnector/", line 399, in update_taxes_with_shipping_lines
    "account_head": get_shipping_account_head(shipping_charge),
  File "apps/woocommerceconnector/woocommerceconnector/", line 412, in get_shipping_account_head
    shipping_account =  frappe.db.get_value("woocommerce Tax Account", \
  File "apps/frappe/frappe/database/", line 509, in get_value
    result = self.get_values(
  File "apps/frappe/frappe/database/", line 606, in get_values
    out = self._get_values_from_table(
  File "apps/frappe/frappe/database/", line 835, in _get_values_from_table
    return, debug=debug, update=update, run=run, pluck=pluck)
  File "apps/frappe/frappe/query_builder/", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "apps/frappe/frappe/database/", line 220, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/", line 158, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/", line 325, in _query
  File "env/lib/python3.10/site-packages/pymysql/", line 549, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/", line 779, in _read_query_result
  File "env/lib/python3.10/site-packages/pymysql/", line 1157, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/", line 729, in _read_packet
  File "env/lib/python3.10/site-packages/pymysql/", line 221, in raise_for_error
  File "env/lib/python3.10/site-packages/pymysql/", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'b'UPS Expedited (Single item small box)' ORDER BY `modified` DESC LIMIT 1' at line 1")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "apps/woocommerceconnector/woocommerceconnector/", line 52, in sync_woocommerce_resources
  File "apps/woocommerceconnector/woocommerceconnector/", line 15, in sync_orders
  File "apps/woocommerceconnector/woocommerceconnector/", line 37, in sync_woocommerce_orders
    if e.args and e.args[0] and e.args[0].decode("utf-8").startswith("402"):
AttributeError: 'int' object has no attribute 'decode'

I feel like this must be a simple issue but I cant quite figure it out.


I’m thinking the master branch of the woocommerce connector isn’t python 3 compatible. Is this correct?

To eliminate this problem, replace the file on line 34:

except woocommerceError as e:
make_woocommerce_log(status=“Error”, method=“sync_woocommerce_orders”, message=frappe.get_traceback(),
request_data=woocommerce_order, exception=True)
except Exception as e:
if e.args and e.args[0] and str(e.args[0]).startswith(“402”):
raise e
make_woocommerce_log(title=str(e), status=“Error”, method=“sync_woocommerce_orders”, message=frappe.get_traceback(),
request_data=woocommerce_order, exception=True)

It is compatible