From 7f111059d2f9fabd407ffaa27b316fe56273319d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alda=20Vigd=C3=ADs=20Skarph=C3=A9=C3=B0insd=C3=B3ttir?= Date: Mon, 5 Aug 2024 19:10:02 +0200 Subject: [PATCH] Work in progress: Initiating work around invoice number meta box for orders --- src/Hooks/Admin.php | 20 ++++++++++++++++++ views/dk_invoice_metabox.php | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 views/dk_invoice_metabox.php diff --git a/src/Hooks/Admin.php b/src/Hooks/Admin.php index 8f7b00a..5fe4c0d 100644 --- a/src/Hooks/Admin.php +++ b/src/Hooks/Admin.php @@ -72,6 +72,11 @@ public function __construct() { 2 ); + add_action( + 'add_meta_boxes', + array( __CLASS__, 'add_dk_invoice_metabox' ) + ); + if ( Config::get_product_convertion_to_variation_enabled() ) { add_filter( 'bulk_actions-edit-product', @@ -88,6 +93,21 @@ public function __construct() { } } + public static function add_dk_invoice_metabox() { + add_meta_box( + '1984-dk-woo-dk-invoice-metabox', + __( 'DK Invoice', '1984-dk-woo' ), + array( __CLASS__, 'render_dk_invoice_metabox' ), + 'shop_order', + context: 'side', + priority: 'high' + ); + } + + public static function render_dk_invoice_metabox() { + require dirname( __DIR__, 2 ) . '/views/dk_invoice_metabox.php'; + } + /** * Filter for adding the DK invoice column to the orders table * diff --git a/views/dk_invoice_metabox.php b/views/dk_invoice_metabox.php new file mode 100644 index 0000000..fbf9cd6 --- /dev/null +++ b/views/dk_invoice_metabox.php @@ -0,0 +1,41 @@ +get_meta( '1984_woo_dk_invoice_number', true, 'edit' ); +$credit_invoice_number = $wc_order->get_meta( '1984_woo_dk_credit_invoice_number', true, 'edit' ); + +?> + +
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+