Automattic\WooCommerce\Internal\StockNotifications\Admin
SettingsController::add_customer_stock_notifications_section
Add a 'Customer stock notifications' section to Products settings.
Метод класса: SettingsController{}
Хуков нет.
Возвращает
array. New Products settings sections.
Использование
$SettingsController = new SettingsController(); $SettingsController->add_customer_stock_notifications_section( $sections );
- $sections(массив) (обязательный)
- Products settings sections.
Код SettingsController::add_customer_stock_notifications_section() SettingsController::add customer stock notifications section WC 11.2.2
public function add_customer_stock_notifications_section( $sections ) {
if ( ! is_array( $sections ) ) {
return $sections;
}
$section_title = __( 'Customer stock notifications', 'woocommerce' );
// Add 'Customer stock notifications' section to the Products tab, after Inventory.
$inventory_index = array_search( 'inventory', array_keys( $sections ), true );
if ( false !== $inventory_index ) {
$sections = array_slice( $sections, 0, $inventory_index + 1, true ) +
array( 'customer_stock_notifications' => $section_title ) +
array_slice( $sections, $inventory_index + 1, null, true );
} else {
$sections['customer_stock_notifications'] = $section_title;
}
return $sections;
}