How to update custom field in WooCommerce
Okay found it. It was a silly mistake I overlooked. I had 1 attribute (esc_attr($myField)) double inside the update_post_meta() method. So this function works perfectly: function woocommerce_save_fields($post_id) { $myField = $_POST[‘field_name’]; if (!empty($myField)) update_post_meta($post_id, ‘field_name’, esc_attr($myField)); else update_post_meta( $post_id, ‘field_name’, ” ); }