woocommerce_products_general_settings

The WooCommerce woocommerce products general settings hook.

Description

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

Parameters (1)

0. $array — Optional. (array) => array( array( 'title' => __( 'Measurements', 'woocommerce' ), 'type' => 'title', 'id' => 'product_measurement_options', ),array( 'title' => __( 'Weight unit', 'woocommerce' ), 'desc' => __( 'This controls what unit you will define weights in.', 'woocommerce' ), 'id' => 'woocommerce_weight_unit', 'class' => 'wc-enhanced-select', 'css' => 'min-width:300px;', 'default' => 'kg', 'type' => 'select', 'options' => array( 'kg' => __( 'kg', 'woocommerce' ), 'g' => __( 'g', 'woocommerce' ), 'lbs' => __( 'lbs', 'woocommerce' ), 'oz' => __( 'oz', 'woocommerce' ), ), 'desc_tip' => true, ),array( 'title' => __( 'Dimensions unit', 'woocommerce' ), 'desc' => __( 'This controls what unit you will define lengths in.', 'woocommerce' ), 'id' => 'woocommerce_dimension_unit', 'class' => 'wc-enhanced-select', 'css' => 'min-width:300px;', 'default' => 'cm', 'type' => 'select', 'options' => array( 'm' => __( 'm', 'woocommerce' ), 'cm' => __( 'cm', 'woocommerce' ), 'mm' => __( 'mm', 'woocommerce' ), 'in' => __( 'in', 'woocommerce' ), 'yd' => __( 'yd', 'woocommerce' ), ), 'desc_tip' => true, ),array( 'type' => 'sectionend', 'id' => 'product_measurement_options', ),array( 'title' => __( 'Reviews', 'woocommerce' ), 'type' => 'title', 'desc' => '', 'id' => 'product_rating_options', ),array( 'title' => __( 'Product ratings', 'woocommerce' ), 'desc' => __( 'Enable ratings on reviews', 'woocommerce' ), 'id' => 'woocommerce_enable_review_rating', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => 'start', 'show_if_checked' => 'option', ),array( 'desc' => __( 'Ratings are required to leave a review', 'woocommerce' ), 'id' => 'woocommerce_review_rating_required', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', 'show_if_checked' => 'yes', 'autoload' => false, ),array( 'desc' => __( 'Show "verified owner" label for customer reviews', 'woocommerce' ), 'id' => 'woocommerce_review_rating_verification_label', 'default' => 'yes', 'type' => 'checkbox', 'checkboxgroup' => '', 'show_if_checked' => 'yes', 'autoload' => false, ),array( 'desc' => __( 'Only allow reviews from "verified owners"', 'woocommerce' ), 'id' => 'woocommerce_review_rating_verification_required', 'default' => 'no', 'type' => 'checkbox', 'checkboxgroup' => 'end', 'show_if_checked' => 'yes', 'autoload' => false, ),array( 'type' => 'sectionend', 'id' => 'product_rating_options', ),)
The array.

Usage

To run the hook, copy the example below.
  1. $array = apply_filters( 'woocommerce_products_general_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_products_general_settings callback 
  2. function filter_woocommerce_products_general_settings( $array ) { 
  3. // make filter magic happen here... 
  4. return $array
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_products_general_settings', 'filter_woocommerce_products_general_settings', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_products_general_settings', 'filter_woocommerce_products_general_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_products_general_settings', array(