export->getShipmentData([$shipment_id], $order);
$deliveryOptions = WCPOST_Admin::getDeliveryOptionsFromOrder($order);
$option_strings = [
"signature" => __("Signature on delivery", "woocommerce-postnl"),
"only_recipient" => __("Only recipient", "woocommerce-postnl"),
];
$firstShipment = $shipments[$shipment_id];
/**
* Show options only for the first shipment as they are all the same.
*/
$insurance = Arr::get($firstShipment, "shipment.options.insurance");
$labelDescription = Arr::get($firstShipment, "shipment.options.label_description");
echo '
';
/**
* Package type
*/
printf(
'%s: %s',
__("Shipment type", "woocommerce-postnl"),
WCPN_Data::getPackageTypeHuman(Arr::get($firstShipment, "shipment.options.package_type"))
);
foreach ($option_strings as $key => $label) {
if (Arr::get($firstShipment, "shipment.options.$key")
&& (int) Arr::get($firstShipment, "shipment.options.$key") === 1) {
printf('- %s
', $key, $label);
}
}
if ($insurance) {
$price = number_format(Arr::get($insurance, "amount") / 100, 2);
printf('- %s: € %s
', __("Insured for", "woocommerce-postnl"), $price);
}
if ($labelDescription) {
printf(
'- %s: %s
',
__("Label description", "woocommerce-postnl"),
$labelDescription
);
}
echo '
';
echo "
";
/**
* Do show the Track & Trace status for all shipments.
*/
foreach ($shipments as $shipment_id => $shipment) {
$trackTrace = Arr::get($shipment, "track_trace");
/**
* Show Track & Trace status.
*/
if (! $trackTrace) {
continue;
}
printf(
'%3$s
%1$s: %4$s
',
__("Status", "woocommerce-postnl"),
WCPOST_Admin::getTrackTraceUrl($order_id, $trackTrace),
$trackTrace,
Arr::get($shipment, "status")
);
}