Last active
January 12, 2017 20:37
-
-
Save dangoodman/363898346c3f2afccf53fa8104e62a29 to your computer and use it in GitHub Desktop.
Round WooCommerce shipping rates to upper close 0.05 (for Swiss franc)
This file contains 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
<?php | |
// Paste everything below this line to your theme's functions.php file. | |
add_filter('woocommerce_package_rates', 'round_shipping_price_for_swiss_franc'); | |
function round_shipping_price_for_swiss_franc($rates) | |
{ | |
if (is_array($rates)) { | |
foreach ($rates as $rate) { | |
$rate->cost = ceil($rate->cost / 0.05) * 0.05; | |
} | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment