diff --git a/template-order-label.php b/template-order-label.php
index 7733d44..5da30db 100644
--- a/template-order-label.php
+++ b/template-order-label.php
@@ -8,6 +8,7 @@ $postcode = $order->get_billing_postcode();
$items = $order->get_items();
$order_date = $order->get_date_created()->date('d/m/Y');
+
?>
@@ -89,32 +90,47 @@ $order_date = $order->get_date_created()->date('d/m/Y');
get_quantity();
- $product_name = $item->get_name();
- $brew_method = $item->get_meta('pa_brew-method');
- $weight = $item->get_meta('weight');
+ // checking if product is a coffee
$product_id = $item->get_product_id();
- $roast = get_field('roast_level', $product_id);
+ $product_categories = get_the_terms($product_id, 'product_cat');
+ $is_coffee = false;
+
+ if (!empty($product_categories) && !is_wp_error($product_categories)) {
+ foreach ($product_categories as $product_category) {
+ if ($product_category->slug == 'coffee') {
+ $is_coffee = true;
+ break;
+ }
+ }
+ }
- for ($i = 0; $i < $quantity; $i++) { ?>
-
-
-
-
-
-
-
Roast
-
Roasted on:
-
NGO
-
-
-
-
-
+ if ($is_coffee) {
+ $quantity = $item->get_quantity();
+ $product_name = $item->get_name();
+ $brew_method = $item->get_meta('pa_brew-method');
+ $weight = $item->get_meta('weight');
+ $roast = get_field('roast_level', $product_id);
+
+ for ($i = 0; $i < $quantity; $i++) { ?>
+
+
+
+
+
+
+
Roast
+
Roasted on:
+
NGO
+
+
-
-