/** * Save the order data upon post saving. * * @param $id int Post ID. */ public function savePost($id) { // Do not save order when trashing or restoring from trash if (!isset($_GET['action'])) { $order = $this->factory->create($id); $this->save($order); if (isset($_POST['reduce_stock'])) { $this->reduceItemsStock($order); } elseif (isset($_POST['restore_stock'])) { $this->restoreItemsStock($order); } elseif (isset($_POST['recalculate_tax'])) { $this->recalculateTax($order); } elseif (isset($_POST['invoice'])) { $this->sendInvoice($order); } } }