• I am setting up a site with s2member and woocommerce. I would like to have the checkout fields for woocommerce be auto populated with the s2member custom fields.

    I have the code below now (for testing) and it will display the WP fields just fine. How do I add to this code so that it will pull the custom fields from s2member (for example I have one called “address”.

    Thanks,
    biorn

    // Hook in
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    
    // Our hooked in function - $fields is passed via the filter!
    function custom_override_checkout_fields( $fields ) {
    	$current_user = wp_get_current_user();
    
         $fields['billing']['billing_first_name']['default'] = $current_user->user_firstname;
    	 $fields['billing']['billing_last_name']['default'] = $current_user->user_lastname;
         return $fields;
    }

    https://wordpress.org/plugins/s2member/

  • The topic ‘s2member woocommerce hooks’ is closed to new replies.