2017-02-25 76 views
0

嘗試更新訂單時使用Woo commerce商業api更新訂單狀態

$ client-> orders-> update_status($ order_id_to_update,$ status);

它使用完全相同的信息創建新訂單,並更新原始訂單和新創建訂單的狀態。 如何防止發生這種情況,並且只能提交我提交的order_ID更改狀態?

回答

0
$order = new WC_Order($order_id); 
$order->update_status('pending'); 

試試這個代碼片段

0

請確認您有給一個連貫order_id_to_update和良好的狀態! 如果您將一個int值置於$狀態,您將獲得一個知道狀態的訂單,因此它在wordpress中不可見