Automattic\WooCommerce\Internal\PushNotifications\Notifications
StockNotification::build_title
Builds the title payload for the notification.
Метод класса: StockNotification{}
Хуков нет.
Возвращает
array{format: string, args: string[]}.
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_title( $product_name ): array;
- $product_name(строка) (обязательный)
- The sanitized product name.
Код StockNotification::build_title() StockNotification::build title WC 11.3.0
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 ),
);
}
}