Automattic\WooCommerce\Internal\PushNotifications\Notifications

StockNotification::should_send_to_userpublicWC 10.9.0

{@inheritDoc}

Extends the base enabled-toggle check with per-event sub-flag filtering.

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

Хуков нет.

Возвращает

true|false.

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

$StockNotification = new StockNotification();
$StockNotification->should_send_to_user( $pref_value ): bool;
$pref_value(разное) (обязательный)
The user's stored preference value, or null.

Список изменений

С версии 10.9.0 Введена.

Код StockNotification::should_send_to_user() WC 10.9.1

public function should_send_to_user( $pref_value ): bool {
	if ( ! parent::should_send_to_user( $pref_value ) ) {
		return false;
	}

	if ( ! is_array( $pref_value ) || ! array_key_exists( $this->event_type, $pref_value ) ) {
		return true;
	}

	return (bool) $pref_value[ $this->event_type ];
}