-
AuthorPosts
-
February 2, 2026 at 6:53 pm #253870

Leonardo LauricellaParticipantHi VillaTheme Team,
I am using the premium version of Orders Tracking for WooCommerce (Versione 1.2.17) and I’m trying to integrate it with an external shipping platform (Qapla) via Webhook.
The carrier we are using is GLS Italy, and the specific slug for your plugin is gls-it.
I need to programmatically insert the tracking number and carrier slug into your plugin’s ‘graphical box’ when an order is updated. Currently, I am using update_post_meta for the following keys, but the data does not appear in the order tracking box in the backend:
_vi_wot_order_item_tracking_data
_vi_wot_order_track_number
_vi_wot_order_carrier_slug
I have already tried to manually update the meta key _vi_wot_order_item_tracking_data using an array, but the tracking info doesn’t appear in the ‘Order Tracking’ box on the WooCommerce Order page.My questions are:
What is the correct meta key or function to ensure the tracking number is correctly saved and visible in your plugin’s UI?
Is there a specific action or hook I should trigger to ‘refresh’ the tracking data and send the tracking email automatically once the meta data is updated via code?(In my next message, I will include the snippet that I use but that does not work as I want it to.)
Thank you for your support! Best regards.Snippet:
add_action(‘init’, ‘ascolta_webhook_diretto_qapla’, 20); // Priorità bassa per caricare dopo i plugin
function ascolta_webhook_diretto_qapla() {
if (isset($_GET[‘ascolta_qapla’])) {
$json = file_get_contents(‘php://input’);
$data = json_decode(trim($json), true);if (!$data || !isset($data[‘orders’][0])) {
status_header(400); die(‘Errore JSON’);
}$order_data = $data[‘orders’][0];
$order_id = trim($order_data[‘reference’]);
$tracking_code = trim($order_data[‘trackingNumber’]);
$courier_slug = ‘gls-it’;if ($order_id && $tracking_code) {
$order = wc_get_order($order_id);
if (!$order) { status_header(400); die(‘Ordine non trovato’); }// 1. Prepariamo il dato per il box grafico (FORMATO ARRAY SERIALIZZATO)
$tracking_array = array(
array(
‘tracking_number’ => $tracking_code,
‘carrier_slug’ => $courier_slug,
‘carrier_name’ => ‘GLS IT’,
‘tracking_url’ => ”,
‘status’ => ‘1’,
‘time’ => current_time(‘mysql’)
)
);// 2. Scrittura diretta nei Meta Fields (Nessun rischio di crash)
update_post_meta($order_id, ‘_vi_wot_order_item_tracking_data’, $tracking_array);
update_post_meta($order_id, ‘_vi_wot_order_status’, ‘1’);// 3. Forziamo il caricamento del numero nel campo semplice del plugin
update_post_meta($order_id, ‘_vi_wot_order_track_number’, $tracking_code);
update_post_meta($order_id, ‘_vi_wot_order_carrier_slug’, $courier_slug);// 4. CAMBIO STATO E NOTA
// Cambiare lo stato a ‘completed’ DOPO aver scritto il tracking è ciò che scatena le email di WooCommerce
$order->update_status(‘completed’, “Tracking $tracking_code inserito correttamente.”);// 5. Nota di conferma finale
$order->add_order_note(“ZIG RECOVERY: Tracking $tracking_code salvato con successo.”);status_header(200);
die(‘OK’);
}
status_header(400); die(‘Dati insufficienti’);
}
}Attachments:
You must be logged in to view attached files. -
AuthorPosts
You must be logged in to see replies to this topic. Click here to login or register