Automattic\WooCommerce\Admin\API
Notes::delete_item()
Delete a single note.
Метод класса: Notes{}
Хуков нет.
Возвращает
WP_REST_Request|WP_Error
.
Использование
$Notes = new Notes(); $Notes->delete_item( $request );
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Код Notes::delete_item() Notes::delete item WC 9.4.2
public function delete_item( $request ) { $note = NotesRepository::get_note( $request->get_param( 'id' ) ); if ( ! $note ) { return new \WP_Error( 'woocommerce_note_invalid_id', __( 'Sorry, there is no note with that ID.', 'woocommerce' ), array( 'status' => 404 ) ); } NotesRepository::delete_note( $note ); $data = $this->prepare_note_data_for_response( $note, $request ); return rest_ensure_response( $data ); }