woocommerce_weight_units filter-hookWC 10.4.0

Filter the available weight units.

Usage

add_filter( 'woocommerce_weight_units', 'wp_kama_woocommerce_weight_units_filter' );

/**
 * Function for `woocommerce_weight_units` filter-hook.
 * 
 * @param array $weight_units Array of weight unit strings.
 *
 * @return array
 */
function wp_kama_woocommerce_weight_units_filter( $weight_units ){

	// filter...
	return $weight_units;
}
$weight_units(array)
Array of weight unit strings.

Changelog

Since 10.4.0 Introduced.

Where the hook is called

Controller::validate_setting_value()
woocommerce/src/Internal/RestApi/Routes/V4/Settings/Products/Controller.php 246
$valid_units = apply_filters( 'woocommerce_weight_units', array( 'kg', 'g', 'lbs', 'oz' ) );

Where the hook is used in WooCommerce

Usage not found.