Hi i will load a custom field Value (from woocommerce) into the acf InputField as default_value.
But it doesn’t work
I wrote this in my functions.php
function my_acf_update_value( $value, $post_id, $field ) {
$post_id = $order->id;
$acfstrasse = get_field_object($field_key, $post_id);
$acfstrasse[‘default_value’] = get_post_meta( $order->id, ‘Strasse’, true );
return $acfstrasse;
}
add_filter(‘acf/update_value/key=field_56572463a9ac7’, ‘my_acf_update_value’, 10, 3);
with:
<?php /* ACF Test*/
$field_key = “field_56572463a9ac7”;
$post_id = $order->id;
$acfstrasse = get_field_object($field_key, $post_id);
$acfstrasse[‘default_value’] = get_post_meta( $order->id, ‘Strasse’, true );
echo $acfstrasse[‘label’] . ‘: ‘ . $acfstrasse[‘value’] . ‘|’ . $acfstrasse[‘default_value’];
?>
I see the Value of the custom Field Strasse