Automattic\WooCommerce\Admin\Notes
Notes::possibly_delete_marketing_notes
Delete marketing notes if marketing has been opted out.
Method of the class: Notes{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = Notes::possibly_delete_marketing_notes( $old_value, $value );
- $old_value(string) (required)
- Old value.
- $value(string) (required)
- New value.
Notes::possibly_delete_marketing_notes() Notes::possibly delete marketing notes code WC 10.4.3
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();
}
}
}