WP Tavern › Forums › Create Topic
Michael Here’s the one I have to arrange rates in order of lowest to highest price: /*SORT SHIPPING COSTS LO TO HI*/ add_filter( ‘woocommerce_package_rates’ , ‘businessbloomer_sort_shipping_methods’, 10, 2 ); function businessbloomer_sort_shipping_methods( $rates, $package ) { if ( !$rates ) return; $tmp = Array(); foreach( $rates as $ma ) { $tmp[] = $ma->cost; } array_multisort( $tmp, $rates ); return $rates; }
Michael
Here’s the one I have to arrange rates in order of lowest to highest price:
/*SORT SHIPPING COSTS LO TO HI*/ add_filter( ‘woocommerce_package_rates’ , ‘businessbloomer_sort_shipping_methods’, 10, 2 );
function businessbloomer_sort_shipping_methods( $rates, $package ) {
if ( !$rates ) return;
$tmp = Array(); foreach( $rates as $ma ) { $tmp[] = $ma->cost; }
array_multisort( $tmp, $rates );
return $rates; }
Name *
Email *
Website:
Topic Title (Maximum Length: 80):
Forum: — No forum —AI and WordPress Articles Blocks Showcase Discussions Events Introductions Jobs and Working in WordPress Podcast Episodes Site and Block Editor
Enter your email address to subscribe to this blog and receive notifications of new posts by email.
Email Address
Submit
Enter the destination URL
Or link to existing content