How Can I remove a particular product from an completed order in woocommerce?
woocommerce, wordpress
Solution
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);
}
}
Problem
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. Please help. Thanks In advance.