item_types_to_group as $group ) { $this->items[ $group ] = array(); } $this->meta_data = array(); } /** * Get the order number to display. * * The real id stays 0, so this provides a representative number for the * preview without tying the order to a database row. * * @return string */ public function get_order_number() { return self::PREVIEW_ORDER_NUMBER; } /** * Block save(). A preview order should never be written to the database. * * @return int The order id (unchanged). */ public function save() { wc_get_logger()->warning( 'Email preview order save() blocked to prevent writing to the database.', array( 'source' => 'email-preview' ) ); return $this->get_id(); } /** * Block save_meta_data(). Extensions sometimes call update_meta_data() * followed by save_meta_data() directly, bypassing save(). */ public function save_meta_data(): void { // Intentionally empty. } /** * Block delete(). A preview order has no row to delete. * * @param bool $force_delete Should the order be deleted permanently. * @return bool Always false. */ public function delete( $force_delete = false ) { return false; } /** * A preview order has no customer notes. The parent passes the id straight * to get_comments(), which treats id 0 as "return every order note". * * @return array */ public function get_customer_order_notes() { return array(); } }