Last active
January 21, 2019 09:33
-
-
Save hendcorp/10846ebfb0a5a49944111ab98a7b32be to your computer and use it in GitHub Desktop.
Override WooCommerce Shipping Cost
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 | |
add_filter( 'woocommerce_package_rates', 'override_ups_rates' ); | |
function override_ups_rates( $rates ) { | |
foreach( $rates as $rate_key => $rate ){ | |
// Check if the shipping method ID is UPS | |
if( ($rate->method_id == 'flexible_shipping_ups') ) { | |
// Set cost to zero | |
$rates[$rate_key]->cost = 0; | |
} | |
} | |
return $rates; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment