Preface:
The Fields Factory module is used:
When choosing coffee, you can add sugar to it. When an order is completed, this additive is listed in the meta order.
Question: how to get these meta in the construction below?
Perhaps you know the solutions on how to register these supplements so that you can work with the API later? Ideally, I want to ensure that these supplements get your article.
This code is written in functions.php to collect information about the order when it is made.
$items = $order->get_items(); $sku = array(); $product_qty = array(); $product_price = array(); foreach( $items as $key => $item){ $product_qty[] = $item['qty']; $product_price[] = $item['line_total']; $item_id = $item['product_id']; $product_item = wc_get_product($item_id); $sku[] = $product_item->get_sku(); }