/** * Delete all invoice data from database and the file. */ public function delete() { // remove all invoice data from db delete_post_meta($this->order->id, '_bewpi_invoice_number'); delete_post_meta($this->order->id, '_bewpi_formatted_invoice_number'); delete_post_meta($this->order->id, '_bewpi_invoice_date'); delete_post_meta($this->order->id, '_bewpi_invoice_year'); // delete file if ($this->exists()) { parent::delete(); } }