Skip to content

Instantly share code, notes, and snippets.

@rajeshsingh520
Created January 15, 2025 06:17
Show Gist options
  • Save rajeshsingh520/891299acccc953b66a60a6a809c2a817 to your computer and use it in GitHub Desktop.
Save rajeshsingh520/891299acccc953b66a60a6a809c2a817 to your computer and use it in GitHub Desktop.
add_filter( 'woocommerce_package_rates', function ( $rates ){
$match = 'pisol_extended_flat_shipping';
$our_rate = [];
foreach ( $rates as $rate_id => $rate ) {
if(strpos($rate_id, 'pisol_extended_flat_shipping') !== false){
$our_rate[$rate_id] = $rate;
unset($rates[$rate_id]);
}
}
if(!empty($our_rate)){
return array_merge($our_rate, $rates);
}
return $rates;
}, PHP_INT_MAX );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment