only render labels for coffees
This commit is contained in:
parent
577703eead
commit
0d8bac003b
@ -8,6 +8,7 @@ $postcode = $order->get_billing_postcode();
|
|||||||
$items = $order->get_items();
|
$items = $order->get_items();
|
||||||
$order_date = $order->get_date_created()->date('d/m/Y');
|
$order_date = $order->get_date_created()->date('d/m/Y');
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -89,11 +90,25 @@ $order_date = $order->get_date_created()->date('d/m/Y');
|
|||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<?php foreach ($items as $item) {
|
<?php foreach ($items as $item) {
|
||||||
|
// checking if product is a coffee
|
||||||
|
$product_id = $item->get_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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($is_coffee) {
|
||||||
$quantity = $item->get_quantity();
|
$quantity = $item->get_quantity();
|
||||||
$product_name = $item->get_name();
|
$product_name = $item->get_name();
|
||||||
$brew_method = $item->get_meta('pa_brew-method');
|
$brew_method = $item->get_meta('pa_brew-method');
|
||||||
$weight = $item->get_meta('weight');
|
$weight = $item->get_meta('weight');
|
||||||
$product_id = $item->get_product_id();
|
|
||||||
$roast = get_field('roast_level', $product_id);
|
$roast = get_field('roast_level', $product_id);
|
||||||
|
|
||||||
for ($i = 0; $i < $quantity; $i++) { ?>
|
for ($i = 0; $i < $quantity; $i++) { ?>
|
||||||
@ -115,6 +130,7 @@ $order_date = $order->get_date_created()->date('d/m/Y');
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php }
|
<?php }
|
||||||
|
}
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user