Add custom field to the ‘My Account’

function my_accout_custom_text_field(){
	$user_id = get_current_user_id();
	$custom_user_text = get_field('tekstfelt', 'user_' . $user_id );
	if ( $custom_user_text ) {
		echo '<div class="custom-text-field">';
		echo $custom_user_text;
		echo '</div>';
	}
}
add_action( 'woocommerce_account_content', 'my_accout_custom_text_field', 9 );

Remember to create a new ACF field and set the Location to ‘User Form is equal to Add /edit’ (‘Brukerskjema er lik Legg til / Rediger’)

Leave a Reply

Your email address will not be published. Required fields are marked *