Automattic\WooCommerce\Internal\PushNotifications\Notifications

StockNotification::get_suppression_reason │ public │ WC 11.3.0

{@inheritDoc}

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

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

Хуков нет.

Возвращает

string|null. One of the SuppressionReason constants, or null to send.

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

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

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

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

Код StockNotification::get_suppression_reason() WC 11.3.0

public function get_suppression_reason( $pref_value ): ?string {
	$reason = parent::get_suppression_reason( $pref_value );

	if ( null !== $reason ) {
		return $reason;
	}

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

	return $pref_value[ $this->event_type ] ? null : SuppressionReason::STOCK_ALERT_OFF;
}