From ffb77dc3c41559765e0ffd25d6c73975d8ac4ebd Mon Sep 17 00:00:00 2001 From: Aadil Ayub Date: Thu, 2 May 2024 08:02:12 +0000 Subject: [PATCH] initial commit --- mont58-coffee-label.php | 42 ++++++++++++++ template-order-label.php | 120 +++++++++++++++++++++++++++++++++++++++ todo.txt | 1 + 3 files changed, 163 insertions(+) create mode 100644 mont58-coffee-label.php create mode 100644 template-order-label.php create mode 100644 todo.txt diff --git a/mont58-coffee-label.php b/mont58-coffee-label.php new file mode 100644 index 0000000..5dda878 --- /dev/null +++ b/mont58-coffee-label.php @@ -0,0 +1,42 @@ +ID; + echo 'View Label'; +} + +// Load custom template +function load_custom_template($template) { + if (is_page('coffee-label')) { + return plugin_dir_path(__FILE__) . 'template-order-label.php'; + } + + return $template; +} + +add_filter('template_include', 'load_custom_template'); \ No newline at end of file diff --git a/template-order-label.php b/template-order-label.php new file mode 100644 index 0000000..5c6565a --- /dev/null +++ b/template-order-label.php @@ -0,0 +1,120 @@ +get_billing_first_name(); +$last_name = $order->get_billing_last_name(); +$postcode = $order->get_billing_postcode(); +$items = $order->get_items(); + +?> + + + + + + + Coffee Label + + + + + + +
+ get_quantity(); + $product_name = $item->get_name(); + $brew_method = $item->get_meta('pa_brew-method'); + $weight = $item->get_meta('weight'); + $product_id = $item->get_product_id(); + $roast = get_field('roast_level', $product_id); + + for ($i = 0; $i < $quantity; $i++) { ?> +
+
+
+

+

+

+

Roast

+

Roasted on: 31/03/2024

+

NGO

+
+
+

+

+

+
+
+
+ +
+ + \ No newline at end of file diff --git a/todo.txt b/todo.txt new file mode 100644 index 0000000..c99859a --- /dev/null +++ b/todo.txt @@ -0,0 +1 @@ +- Use query param to get order id : '/wp-content/plugins/awesomeplugin/label.php?order_id=1234' \ No newline at end of file