woocommerce_sort_fees_callback filter-hookWC 3.8.0

Filter sort fees callback.

Usage

add_filter( 'woocommerce_sort_fees_callback', 'wp_kama_woocommerce_sort_fees_callback_filter', 10, 3 );

/**
 * Function for `woocommerce_sort_fees_callback` filter-hook.
 * 
 * @param int      $-1 Sort order, -1 or 1.
 * @param stdClass $a  Fee object.
 * @param stdClass $b  Fee object.
 *
 * @return int
 */
function wp_kama_woocommerce_sort_fees_callback_filter( $-1, $a, $b ){

	// filter...
	return $-1;
}
$-1(int)
Sort order, -1 or 1.
$a(stdClass)
Fee object.
$b(stdClass)
Fee object.

Changelog

Since 3.8.0 Introduced.

Where the hook is called

WC_Cart_Fees::sort_fees_callback()
woocommerce_sort_fees_callback
woocommerce/includes/class-wc-cart-fees.php 147
return apply_filters( 'woocommerce_sort_fees_callback', $a->amount > $b->amount ? -1 : 1, $a, $b );

Where the hook is used in WooCommerce

Usage not found.