Automattic\WooCommerce\Admin\Notes

Notes::possibly_delete_marketing_notes()public staticWC 1.0

Delete marketing notes if marketing has been opted out.

Метод класса: Notes{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$result = Notes::possibly_delete_marketing_notes( $old_value, $value );
$old_value(строка) (обязательный)
Old value.
$value(строка) (обязательный)
New value.

Код Notes::possibly_delete_marketing_notes() WC 7.3.0

public static function possibly_delete_marketing_notes( $old_value, $value ) {
	if ( 'no' !== $value ) {
		return;
	}

	$data_store = self::load_data_store();
	$note_ids   = $data_store->get_note_ids_by_type( Note::E_WC_ADMIN_NOTE_MARKETING );

	foreach ( $note_ids as $note_id ) {
		$note = self::get_note( $note_id );
		if ( $note ) {
			$note->delete();
		}
	}
}