Support

Account

Home Forums General Issues Store and retrieve custom meta data

Helping

Store and retrieve custom meta data

  • Pre sales question:

    Situation: The site has parents registering their children for events (waterpolo site where parents have multiple children and they register and pay for multiple tournaments during a season)

    Problem:
    Each time a parent registers a child for a tournament, they have to enter in all the information about the child that was entered into WP via the woocommerce.

    Question: Is there a way to collect all the data about their children, store it, and retrieve it during either a checkout process or gravity forms, or some other way to retrieve it each time the parent wishes to register?

    I’m not a coder, but I can edit php. Any thoughts would be greatly appreciated.

    Joel

  • Hi @joelpdavis,

    Thanks for the post.

    In this use case, you can make use of the acf/load_field filter to dynamically populate the data that was initially entered on the user form.

    You will need to call this filter for each of the fields in your form and have them populate the corresponding custom fields on the registration page.

    The code would look like so:

    <?php
    
    function my_acf_load_field( $field ) {
    	
        $field['value'] = "new_value_from_user_form";
    
        return $field;
        
    }
    
    add_filter('acf/load_field/name=my_fieldname', 'my_acf_load_field');
    
    ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Store and retrieve custom meta data’ is closed to new replies.