• rflores

    (@rflores)


    Got a project with WordPress that uses the wp-client & woocommerce plugin. New users get registered on checkout. I need to call a 3rd party’s REST API to update a remote database when new users are registered and when current users get updated. I also need to update product subscriptions through the 3rd party’s REST API.

    I created my own plugin to do this but I’m pulling my hair out because I can’t figure out how to do this. I tried using an action hook for either the WordPress “user register” and I even tried to use the WP-Client action hook “wpc_client_new_client_registered”.

    I tried using echo statements to see if they fire off but all that happens is that the checkout complete page commences. How do I use these hooks and how can I get the registered user’s data so I can use cURL to call the REST API?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    ‘user_register’ should fire, but using echo to test this probably will not work. echo is often inappropriate in many action callbacks because the browser is not yet expecting content from the server. You need to use something independent of browser state, either through output buffering or using error_log() or some other file write function. I know at least one dev who uses wp_mail() for this purpose, emailing himself debug data ??

Viewing 1 replies (of 1 total)
  • The topic ‘Using Action Hooks’ is closed to new replies.