Okay so you're saying that the company field is a custom field on each User's profile, correct? And you would like to be able to access that information to populate a field in your woo_commerce_checkout_get_value function.
Unless you have defined $company as a global variable, this won't work. PHP isn't designed to automatically share variables across functions like this. I don't think you need a variable here, though, instead you can access the information directly using the types_render_usermeta function. If your user custom field has the slug "company" then you can try this code to display the logged-in user's company:
types_render_usermeta( "company", array( "user_current" => true ) );
We have more information and examples here:
https://toolset.com/documentation/customizing-sites-using-php/functions/#textfield
Click the orange +More button for more examples.
add_filter('save_post', 'combine_my_fields');
function combine_my_fields($post_id) {
$company = get_post_meta($post_id, 'wpcf-firmenname', true);
update_post_meta($post_id, 'full-company', $company);
}
I don't think this code is necessary. It looks like it's just taking the value of one custom field and saving it in another custom field. If the intention was just to save a variable, then this can be deleted altogether. If you need the company name stored in this other field for some reason, then you can keep it.
I am not sure even how to check if it is indeed saved as a variable but all I got so far was the company field saying "Array" on checkout so either the saving of the variable is wrong or the way I am trying to return it.
I don't think you need to save a variable as I've mentioned above, but in the future you can use PHP's error_log function to write out information while code is executing. Go in your wp-config.php file and look for define(‘WP_DEBUG’, false);. Change it to:
define('WP_DEBUG', true);
Then add these lines, just before it says 'stop editing here':
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
Then, you can use the error_log function to write to that error log file.
error_log($variable);
error_log(print_r($array, true));
After you're finished you can turn logging off by reverting the changes in your wp-config.php file.