Support

Account

Home Forums Front-end Issues Frontend form without submit Reply To: Frontend form without submit

  • I’m not completely sure how WC works in this case, but no, I don’t think acf_form() will help you.

    Guessing that this is what’s happening

    1. Submit form
    2. WC does an AJAX request to submit the form
    3. WC redirects

    ACF fields have not been submitted yet, ACF does not run on the AJAX request, but if you use acf_form() it is still loading everything that it would normally load for field validation and detecting changes.

    In order to use acf_form() you would need to:

    1. Add an action to all form fields and the form submit action that would clear the flag that tells ACF that something has been changed – I don’t know how to do this
    2. You would need to call acf_form_head() in your filter – This is a guess, I don’t know if this will work
    3. You would still need an acf/pre_save_post filter to cause ACF to save the values to the user instead of $order_id

    There are a lot of pieces here and some of what needs to be done is unknown. For me, it would just be easier to hand code the form fields rather than use ACF form and then update the user ACF fields with those values using update_field(). The amount of work and code would be far less, not to mention the hours of testing that would be involved and possibly completely failing to get it to work since I’m not certain that it can be done.