WC_Helper::remove_api_error_noticeprotected staticWC 1.0

Remove all notes signaling an error with the WCCOM API, when the request was successful.

Method of the class: WC_Helper{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = WC_Helper::remove_api_error_notice();

WC_Helper::remove_api_error_notice() code WC 10.3.3

protected static function remove_api_error_notice() {
	try {
		$data_store = \WC_Data_Store::load( 'admin-note' );
	} catch ( Exception $e ) {
		return;
	}

	$note_ids = $data_store->get_notes_with_name( self::NOTE_NAME );

	if ( ! empty( $note_ids ) ) {
		foreach ( $note_ids as $note_id ) {
			$note = new Note( $note_id );
			if ( $note->get_id() ) {
				$data_store->delete( $note );
			}
		}
	}
}