woocommerce_inventory_settings

The WooCommerce woocommerce inventory settings hook.

Description

apply_filters( 'woocommerce_inventory_settings', (array) $array ); 

Parameters (1)

0. $array — Optional. (array) => array(array( 'title' => __( 'Inventory', 'woocommerce' ), 'type' => 'title', 'desc' => '', 'id' => 'product_inventory_options', ),array( 'title' => __( 'Manage stock', 'woocommerce' ), 'desc' => __( 'Enable stock management', 'woocommerce' ), 'id' => 'woocommerce_manage_stock', 'default' => 'yes', 'type' => 'checkbox', ),array( 'title' => __( 'Hold stock (minutes)', 'woocommerce' ), 'desc' => __( 'Hold stock (for unpaid orders) for x minutes. When this limit is reached, the pending order will be cancelled. Leave blank to disable.', 'woocommerce' ), 'id' => 'woocommerce_hold_stock_minutes', 'type' => 'number', 'custom_attributes' => array( 'min' => 0, 'step' => 1, ), 'css' => 'width: 80px;', 'default' => '60', 'autoload' => false, 'class' => 'manage_stock_field', ),array( 'title' => __( 'Notifications', 'woocommerce' ), 'desc' => __( 'Enable low stock notifications', 'woocommerce' ), 'id' => 'woocommerce_notify_low_stock', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', 'autoload' => false, 'class' => 'manage_stock_field', ),array( 'desc' => __( 'Enable out of stock notifications', 'woocommerce' ), 'id' => 'woocommerce_notify_no_stock', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'end', 'autoload' => false, 'class' => 'manage_stock_field', ),array( 'title' => __( 'Notification recipient(s)', 'woocommerce' ), 'desc' => __( 'Enter recipients (comma separated) that will receive this notification.', 'woocommerce' ), 'id' => 'woocommerce_stock_email_recipient', 'type' => 'text', 'default' => get_option( 'admin_email' ), 'css' => 'width: 250px;', 'autoload' => false, 'desc_tip' => true, 'class' => 'manage_stock_field', ),array( 'title' => __( 'Low stock threshold', 'woocommerce' ), 'desc' => __( 'When product stock reaches this amount you will be notified via email.', 'woocommerce' ), 'id' => 'woocommerce_notify_low_stock_amount', 'css' => 'width:50px;', 'type' => 'number', 'custom_attributes' => array( 'min' => 0, 'step' => 1, ), 'default' => '2', 'autoload' => false, 'desc_tip' => true, 'class' => 'manage_stock_field', ),array( 'title' => __( 'Out of stock threshold', 'woocommerce' ), 'desc' => __( 'When product stock reaches this amount the stock status will change to "out of stock" and you will be notified via email. This setting does not affect existing "in stock" products.', 'woocommerce' ), 'id' => 'woocommerce_notify_no_stock_amount', 'css' => 'width:50px;', 'type' => 'number', 'custom_attributes' => array( 'min' => 0, 'step' => 1, ), 'default' => '0', 'desc_tip' => true, 'class' => 'manage_stock_field', ),array( 'title' => __( 'Out of stock visibility', 'woocommerce' ), 'desc' => __( 'Hide out of stock items from the catalog', 'woocommerce' ), 'id' => 'woocommerce_hide_out_of_stock_items', 'default' => 'no', 'type' => 'checkbox', ),array( 'title' => __( 'Stock display format', 'woocommerce' ), 'desc' => __( 'This controls how stock quantities are displayed on the frontend.', 'woocommerce' ), 'id' => 'woocommerce_stock_format', 'css' => 'min-width:150px;', 'class' => 'wc-enhanced-select', 'default' => '', 'type' => 'select', 'options' => array( '' => __( 'Always show quantity remaining in stock e.g. "12 in stock"', 'woocommerce' ), 'low_amount' => __( 'Only show quantity remaining in stock when low e.g. "Only 2 left in stock"', 'woocommerce' ), 'no_amount' => __( 'Never show quantity remaining in stock', 'woocommerce' ), ), 'desc_tip' => true, ),array( 'type' => 'sectionend', 'id' => 'product_inventory_options', ),)
The array.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'woocommerce_inventory_settings', $array ); 
  2.  
  3. if ( !empty( $array ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_inventory_settings callback 
  2. function filter_woocommerce_inventory_settings( $array ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_inventory_settings', 'filter_woocommerce_inventory_settings', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_inventory_settings', 'filter_woocommerce_inventory_settings', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/admin/settings/class-wc-settings-products.php  
  1. $settings = apply_filters( 'woocommerce_inventory_settings', array(