如何从 woocommerce 的已完成订单中删除特定产品? [英] How Can I remove a particular product from an completed order in woocommerce?
本文介绍了如何从 woocommerce 的已完成订单中删除特定产品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 woocommerce 插件.我的要求是从已完成的订单中删除特定产品.
I am using woocommerce plugin. My requirement is to remove a particular product from a completed order.
我还没有找到任何解决方案.
I am not able to find any solution yet.
请帮忙.
提前致谢.
推荐答案
我自己找到了答案.我使用下面的代码并且它有效.
I found the answer myself. I use the code below and it worked.
$order = wc_get_order(35);
foreach ($order->get_items() as $item_id => $item) {
if ($item_id == 3) {
wc_delete_order_item($item_id);
}
}
这篇关于如何从 woocommerce 的已完成订单中删除特定产品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文