Add-ons problem
-
Hello, I am coding a template to print the orders directly and automatically.
How can I get those add-ons right.
Here is my code:<?php foreach ($order->get_items() as $item) { /* @var $item \WC_Order_item */ $meta = $item['item_meta']; $meta = array_filter($meta, function ($key) { return !in_array($key, Order::getHiddenKeys()); }, ARRAY_FILTER_USE_KEY); ?> <?= Document::symbolsAlign($item['name'] . ' × ' . $item['qty'], wc_price($item->get_data()['total'], array('currency' => $order->get_currency()))); ?> <?php $meta = array_map(function ($meta, $key) { return Document::symbolsAlign(' ' . $key, $meta . ' '); }, $meta, array_keys($meta)); echo implode('', $meta); ?> <?php } ?>Here is the result:
Veg. Keema Masala × 1 €14,95
_addon_items Array
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
The topic ‘Add-ons problem’ is closed to new replies.