wc_checkout_fields_uasort_comparison()WC 3.5.1

User to sort checkout fields based on priority with uasort.

Хуков нет.

Возвращает

int.

Использование

wc_checkout_fields_uasort_comparison( $a, $b );
$a(массив) (обязательный)
First field to compare.
$b(массив) (обязательный)
Second field to compare.

Список изменений

С версии 3.5.1 Введена.

Код wc_checkout_fields_uasort_comparison() WC 8.7.0

function wc_checkout_fields_uasort_comparison( $a, $b ) {
	/*
	 * We are not guaranteed to get a priority
	 * setting. So don't compare if they don't
	 * exist.
	 */
	if ( ! isset( $a['priority'], $b['priority'] ) ) {
		return 0;
	}

	return wc_uasort_comparison( $a['priority'], $b['priority'] );
}