Automattic\WooCommerce\Internal\PushNotifications\Notifications

StockNotification::build_titleprivateWC 1.0

Builds the title payload for the notification.

Method of the class: StockNotification{}

No Hooks.

Returns

Array{format:. string, args: string[]}

Usage

// private - for code of main (parent) class only
$result = $this->build_title( $product_name ): array;
$product_name(string) (required)
The sanitized product name.

StockNotification::build_title() code WC 10.9.1

private function build_title( string $product_name ): array {
	switch ( $this->event_type ) {
		case self::EVENT_OUT_OF_STOCK:
			return array(
				'format' => 'Out of stock: %1$s %2$s',
				'args'   => array( $product_name, self::EMOJI_OUT_OF_STOCK ),
			);

		case self::EVENT_ON_BACKORDER:
			return array(
				'format' => 'Backordered: %1$s %2$s',
				'args'   => array( $product_name, self::EMOJI_ON_BACKORDER ),
			);

		default:
			return array(
				'format' => 'Low stock: %1$s %2$s',
				'args'   => array( $product_name, self::EMOJI_LOW_STOCK ),
			);
	}
}