Woocomerce intregration Error: Customer not found

Greetings.

I’ve integrated Woocomerce (configured endpoint and web-hook) to ERP, but when I generate an order, it can’t find the customer. The customer has been created in ERP and Woocomerce by themselves. So I don’t know where is it searching or how is it doing it, to know why it’s not finding the customer.

Thanks in advance for your answer.

Customer in ERP:

Error log:

Traceback (most recent call last):
  File "apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py", line 29, in order
    _order(*args, **kwargs)
  File "apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py", line 60, in _order
    create_sales_order(order, woocommerce_settings, customer_name, sys_lang)
  File "apps/erpnext/erpnext/erpnext_integrations/connectors/woocommerce_connection.py", line 183, in create_sales_order
    new_sales_order.insert()
  File "apps/frappe/frappe/model/document.py", line 237, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 977, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 874, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1171, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1154, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 868, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py", line 41, in validate
    super(SalesOrder, self).validate()
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 30, in validate
    super(SellingController, self).validate()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 29, in validate
    super(StockController, self).validate()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 120, in validate
    self.set_missing_values(for_validate=True)
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 47, in set_missing_values
    self.set_missing_lead_customer_details(for_validate=for_validate)
  File "apps/erpnext/erpnext/controllers/selling_controller.py", line 72, in set_missing_lead_customer_details
    party_details = _get_party_details(customer,
  File "apps/erpnext/erpnext/accounts/party.py", line 57, in _get_party_details
    if not ignore_permissions and not (frappe.has_permission(party_type, "read", party) or frappe.has_permission(party_type, "select", party)):
  File "apps/frappe/frappe/__init__.py", line 751, in has_permission
    out = frappe.permissions.has_permission(doctype, ptype, doc=doc, verbose=verbose, user=user,
  File "apps/frappe/frappe/permissions.py", line 24, in inner
    result = func(*args, **kwargs)
  File "apps/frappe/frappe/permissions.py", line 61, in has_permission
    doc = frappe.get_doc(meta.name, doc)
  File "apps/frappe/frappe/__init__.py", line 910, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 72, in get_doc
    return controller(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 110, in __init__
    self.load_from_db()
  File "apps/frappe/frappe/model/document.py", line 153, in load_from_db
    frappe.throw(_("{0} {1} not found").format(_(self.doctype), self.name), frappe.DoesNotExistError)
  File "apps/frappe/frappe/__init__.py", line 446, in throw
    msgprint(msg, raise_exception=exc, title=title, indicator='red', is_minimizable=is_minimizable, wide=wide, as_list=as_list)
  File "apps/frappe/frappe/__init__.py", line 425, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 379, in _raise_exception
    raise raise_exception(msg)
frappe.exceptions.DoesNotExistError: Customer Test name Test last name not found

Did you review “Customer Naming By” field Selling settings? It’s should be on “Customer Name” option.

It worked! Thanks

What happens if two customers with the same name order at your woocommerce shop?
Does each sales order get allocated to the right customer?

Yeah, I find the users with their email, and they can’t create another user with the same mail