Automattic\WooCommerce\Internal\StockNotifications

Notification::get_unsubscribe_keypublicWC 1.0

Maybe setup verification data for the notification.

This is used to ensure that the notification has valid verification data.

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

Хуков нет.

Возвращает

Строку. The generated unsubscribe key.

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

$Notification = new Notification();
$Notification->get_unsubscribe_key( $persist ): string;
$persist(true|false) (обязательный)
If true, save the changes to the database.

Код Notification::get_unsubscribe_key() WC 10.5.2

public function get_unsubscribe_key( bool $persist ): string {
	$key  = wp_generate_password( 20, false );
	$hash = HasherHelper::wp_fast_hash( $key );
	$this->update_meta_data( 'email_link_action_key', $hash );

	if ( $persist ) {
		$this->save();
	}

	return $key;
}