custom sorting in woocommerce – numbers arent sorting right?
-
Hey
I got a problem, I have made a custom sorting option in woocommerce.
To sort by a meta value, a decimal number. However it looks like woocommerce/wordpress thinks that 7.60 is bigger then 66.00, and 5.70 is bigger then 43.70 and I cant figure why it is not sorting right?And it is both doing it when sorting ASC or with DESC, some of the products gets messed up in the sorting.
if( isset( $_GET['orderby'] ) && 'protein-asc' === $_GET['orderby'] ) { $args['meta_key'] = 'dbs_protein'; $args['orderby'] = array( 'meta_value' => 'ASC');
Anybody knows why? Is it a datatype problem, or?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘custom sorting in woocommerce – numbers arent sorting right?’ is closed to new replies.