Home Forums ACF PRO Append Fields to WooCommerce Register Form Reply To: Append Fields to WooCommerce Register Form

  • You would put the class in your functions.php file. It will instantiate when the file is loaded and add the needed action and filter will be added to WP.

    I use a class because we must get the new user ID with one filter and then use it in another filter. To do this you have 2 choices, create a class that can store values independently or use global variables, and I’m not a fan of global variables.

    And as I said in my last post, I am not sure that it will work, it’s all just a guess.

    If it does work, the method user_register() will run when a new user is registered, storing the new user id.

    Then the method pre_save_post() will run before ACF saves the post and we set the correct user ID for that user so ACF stores the values in the right place.

    This all hinges on the hook user_register firing before acf/pre_save_post