更新时间:2023-11-30 07:51:03
我自己找到了答案.我使用下面的代码并且它有效.
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);
}
}