wc_products_array_orderby_menu_order( WC_Product $a, WC_Product $b )

Sort by menu order.


Description Description


Parameters Parameters

$a

(Required) First WC_Product object.

$b

(Required) Second WC_Product object.


Top ↑

Return Return

(int)


Top ↑

Source Source

File: includes/wc-product-functions.php

function wc_products_array_orderby_menu_order( $a, $b ) {
	if ( $a->get_menu_order() === $b->get_menu_order() ) {
		return 0;
	}
	return ( $a->get_menu_order() < $b->get_menu_order() ) ? -1 : 1;
}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.