Created
May 24, 2017 06:20
-
-
Save aliciaiceland/06eafad312f006c657e278376ab3b236 to your computer and use it in GitHub Desktop.
Modify flat rate shipping cost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flat_rates_cost( $rates, $package ) { | |
foreach($rates as $key => $rate){ | |
if($rate->method_id == 'flat_rate'){ | |
// Put your logic and modify | |
$rates[$key]->cost = 25; | |
} | |
} | |
return $rates; | |
} | |
add_filter( 'woocommerce_package_rates', 'flat_rates_cost', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment