Error while syncing existing contacts/customers
-
If a contact/email address already exists in HubSpot, the plugin fails to sync the WooCommerce customer profile and the HubSpot profile.
The problem is that the HubSpot API responds with an error that the plugin apparently cannot handle correctly, resulting in a missing entry for the user metadata
hubwoo_user_vid
.This means that
hubwoo_user_vid
is not available for upcoming synchronization tasks – which in our case resulted in failed deal-to-contact associations.One can fix this error by providing logic that catches the HubSpot API error response in the case of pre-existing contact profiles.
In the source code file
class-hubwooobjectproperties.php
in lines 95 ff, the plugin tries to catch multiple error cases, from which none works in the mentioned case. This is because thecreate_object_record()
method has to work with an instance ofWP_Error
, and as a result returns an array where$response['status_code'] == 'error'
, instead of one of the HTTP status codes the plugin is looking for. The if statement, where the plugin looks for an HTTP409 Conflict
status code, is never fired.Instead, one needs to check if the returned response indicates that the given email address already exists (for example, by searching for
Existing ID:
in the response coming from HubSpot) and then save the returned ID ashubwoo_user_vid
user meta.We have fixed this bug in a custom branch of the plugin for ourselves, but would greatly appreciate a quick fix from the plugin authors.
Thanks!
- The topic ‘Error while syncing existing contacts/customers’ is closed to new replies.