• Resolved rcain

    (@rcain)


    Hi there,

    I need to add custom fields from woocomerce (guest) orders to deals on the hubspot system.

    I have defined custom properties already against the hubspot deals (using internal_name and the ecommerce group) – supposing this is correct?

    I have also searched your plugin code for filters that I might use to implement this – eg: the hubwoo_map_ecomm_DEAL_properties filter, & the hubwoo_ecomm_bridge_object_properties filter & some others.

    Could you tell me please, is there any documentation/guidance on how to achieve this? Or could you provide me a few pointers or a quick summary?- just to save me a lot of experimentation/trial and error (I am an experienced wp/woo coder, though hubspot is fairly new to me).

    Thank you for any help you can provide.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author MakeWebBetter

    (@makewebbetter)

    Hello @rcain ,
    You can use the action hook “hubwoo_ecomm_deal_created” which is added in our plugin. It will give you the order ID.
    Using the order ID you can get the deal ID which is saved as order meta “hubwoo_ecomm_deal_id”. Then you just need to send this deal ID and the array of properties to “update a deal” API of HubSpot.

    Thank you

    Thread Starter rcain

    (@rcain)

    Hi there,

    Thanks for this. However, does not seem to be quite what I was after. (ie: that hook is called AFTER the sync call to hubspot completes – seems rather inefficient/illogical to have to make a second series of calls at this point).

    I was hoping to simply extend the list of (custom) order properties that your plugin sends up to hubspot during a) initial sync of customers and historical order data, b) all real-time sync of contacts and orders up to hubspot, whenever guest orders are made on the website. Is this possible?

    Is there any further documentation/support available to help me? (nothing comes up on your knowledge base).

    Thanks again

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hello Rcain

    You can use the action hook “hubwoo_ecomm_deal_created” which is added in our plugin. It will give you the order ID.
    Using the order ID you can get the deal ID which is saved as order meta “hubwoo_ecomm_deal_id”. Then you just need to send this deal ID and the array of properties to “update a deal” API of HubSpot.

    Thank you

    Thread Starter rcain

    (@rcain)

    Hi there,

    OK, so I took your advice & used hubwoo_ecomm_deal_created hook – which does work. Thanks

    However, this still doesn’t explain why extending the original sync api calls didn’t work. No real help from Hubspot themselves there either. Oh well.

    On thing I did notice:

    Your code seems to be calling the hubwoo_ecomm_deal_created hook MULTIPLE TIMES per order.

    I only get the order_id as a parameter to the hook, not any of the previous api response code or other contextual info, therefore I have to make my hubspot update_deal api call regardless – so we end up making multiple update calls for the SAME update. This is obviously extremely wasteful of computing resource and potentially adds to user response times, etc.

    I wonder if someone to take a look and check please, how/why these multiple calls to the hubwoo_ecomm_deal_created hook are being raised?

    Many thanks

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi @rcain

    Apologies for your confusion but “hubwoo_ecomm_deal_created” hook is not called anywhere in the plugin. It is just given with do_action() to extend the code.

    There is an order meta which is also given the same name, that is, “hubwoo_ecomm_deal_created” which is being used multiple times in the code with query parameters.

    Please cross-check once and let us know if you still have any doubts.

    Thread Starter rcain

    (@rcain)

    HI,

    Thanks for your reply.

    Yes, I realize all of that. But the hook is getting triggered (it seems) multiple times per order. Can you think why this might be?

    Many thanks.

    Plugin Author MakeWebBetter

    (@makewebbetter)

    Hi @rcain

    Thanks for bringing this to our notice. It seems to be happening because of the “woocommerce_update_order” hook being called two times on the front end.

    We would need to check the code again on how we can avoid this from happening and would probably release the next update with a fix to this very soon.

    If you want an immediate fix then our team can look into it for you. Please contact our support for the same.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘adding order custom fields to hubspot deal properties’ is closed to new replies.