【发布时间】:2018-01-22 21:50:35
【问题描述】:
在 Woocommerce 中,我在管理区域有一份报告,该报告统计了已售产品。网站上仅售出 5 种产品,但有些产品有 1 或 2 种变体。该报告效果很好,但忽略了变化。
我需要从订购的项目中检索属性值以准确显示数据。
我该怎么做呢?
get_variation_description() 无法按照我的应用方式工作。
我的代码:
$order = wc_get_order( $vs);
//BEGIN NEW RETRIEVE ORDER ITEMS FROM ORDER
foreach( $order->get_items() as $item_id => $item_product ){
$ods = $item_product->get_product_id(); //Get the product ID
$odqty= $item_product->get_quantity(); //Get the product QTY
$item_name = $item_product->get_name(); //Get the product NAME
$item_variation = $item_product->get_variation_description(); //NOT WORKING
}
【问题讨论】:
标签: php wordpress woocommerce product variations