【发布时间】:2013-11-14 20:19:34
【问题描述】:
如何使用产品 ID 获取产品描述或产品对象。
$order = new WC_Order($order_id);
foreach ($order->get_items() as $item) {
$product_description = get_the_product_description($item['product_id']); // is there any method can I use to fetch the product description?
}
上面的代码扩展类 WC_Payment_Gateway
任何帮助将不胜感激。
【问题讨论】:
-
提示:如果您的描述写在帖子内容中,请使用文森特的答案;如果您的描述写在 WooCommerce 的产品描述字段中,请使用 Raunak 的答案。
标签: php wordpress woocommerce product orders