In Woocommerce admin order list on the preview page i’m trying to add after “note” my “track & trace”.
I’m looking for documentation where wc-order-preview-note is registered to add it after but I don’t seem to be able to find it.
How it looks like now
It has to check on the detail page what is fild in on “track & trace”
<?php
// Weergave van het Track & Trace veld in WooCommerce Admin Order Details
add_action('woocommerce_admin_order_data_after_order_details', function ($order) {
woocommerce_wp_text_input(array(
'id' => '_track_trace_field',
'label' => __('Track & Trace:', 'text-domain'),
'placeholder' => __('Voer trackingnummer in', 'text-domain'),
'description' => __('Voer het trackingnummer voor de bestelling in.', 'text-domain'),
'value' => get_post_meta($order->get_id(), '_track_trace_field', true),
'desc_tip' => true,
));
}, 10, 1);
// Opslaan van het Track & Trace veld
add_action('woocommerce_process_shop_order_meta', function ($post_id, $post) {
if (!empty($_POST['_track_trace_field'])) {
update_post_meta($post_id, '_track_trace_field', sanitize_text_field($_POST['_track_trace_field']));
}
}, 10, 2);
?>