1
我正在開發一個Woocommerce和Woosensei插件 我似乎無法獲得以編程方式創建訂單的流程,標記完成的訂單並激活該特定的woosensei課程人。在Woocommerce訂單完成後,激活woosensei課程
// create a new checkout instance and order id
$checkout = new WC_Checkout();
$this_order_id = $checkout->create_order();
// add some data to the order here //
[ ......... ]
// execute order
$order = new WC_Order($this_order_id);
$order->update_status('completed');
$learning = new WooThemes_Sensei();
$learning->sensei_woocommerce_complete_order($this_order_id);
$cart = new WC_Cart();
$cart->empty_cart();
訂單被標記爲完整,但用戶無權訪問該課程。 如果我手動將訂單更改回處理中,並在此之後完成(在WP管理員中),則該課程將分配給用戶。 這真的很煩人,希望有人有一些線索(嗚記錄不好....) Thx提前!