Closed WeLoTech closed 4 weeks ago
@dvdl16 any pointers here?
@WeLoTech thanks for raising the issue. Unfortunately this part of the code was inherited from ERPNext's v14 WooCommerce integration. I'm traveling until the 9th of Oct, can only look into this when I'm back
Okay. I will have a look in the meantime to see if I can deploy a fix.
I've made some quick fixes addressing the core issue with customer generation. Previously, the identifier for customers/contacts was solely based on woocommerce_email, which led to complications.
Key Changes:
New Unique Identifier: Instead of relying solely on woocommerce_email, I've introduced a new mechanism. If no email exists, an order-based guest user is created. This approach prevents the creation of a single ERPNext customer without an email from being overwritten by a new customer (i.e., the same user being replaced by a different user).
I believe this resolves the underlying issue. Please review and let me know if there are any further concerns.
Current Behavior
On initial setup I frequently encounter the same error: "WooCommerce Error."
It appears that during the auto-sync of a customer and address using the woocommerce_fusion plugin, an IntegrityError is raised due to a duplicate entry for the primary key. This leads to a DuplicateEntryError being thrown. This error occurs approximately 30 times and seems to be associated exclusively with all guest orders (maybe only the guest orders that order multiple times with the same guest email).
Steps To Reproduce
Expected Behavior
Guests who order are also created as customers in the erp with the invoice details added by the guest and woocommerce_email just like registered users would order.
Anything else?
What would be workarounds to fix manually or programmatically while a fix is created?
Environment and Versions
Operating System
Other
What browsers are you seeing the problem on?
No response