_wc_get_product_terms_name_num_usort_callback()WC 1.0

Sort by name (numeric).

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

Int.

Usage

_wc_get_product_terms_name_num_usort_callback( $a, $b );
$a(WP_Post) (required)
First item to compare.
$b(WP_Post) (required)
Second item to compare.

_wc_get_product_terms_name_num_usort_callback() code WC 8.9.0

function _wc_get_product_terms_name_num_usort_callback( $a, $b ) {
	$a_name = (float) $a->name;
	$b_name = (float) $b->name;

	if ( abs( $a_name - $b_name ) < 0.001 ) {
		return 0;
	}

	return ( $a_name < $b_name ) ? -1 : 1;
}