public static function order_action_download_shipping_label($order) { $order_label = new WC_Order_Shipping_Label($order); $label_data = $order_label->shipping_label_data(); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=label.zpl"); echo $label_data; exit; }