Last active
June 7, 2017 01:25
-
-
Save harishankerr/e06b62e57a71c94835467ac2306e1ebb to your computer and use it in GitHub Desktop.
Add Handling Fee To Flat Rate Shipping Method
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
function wc_ninja_change_flat_rates_cost( $rates, $package ) { | |
// Make sure flat rate is available | |
if ( isset( $rates['flat_rate'] ) ) { | |
// Adds a $3 handling fee to the existing flat rate shipping method. | |
$rates['flat_rate']->cost += 3; | |
} | |
return $rates; | |
} | |
add_filter( 'woocommerce_package_rates', 'wc_ninja_change_flat_rates_cost', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment