Skip to content

Instantly share code, notes, and snippets.

@hendcorp
Last active January 21, 2019 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendcorp/10846ebfb0a5a49944111ab98a7b32be to your computer and use it in GitHub Desktop.
Save hendcorp/10846ebfb0a5a49944111ab98a7b32be to your computer and use it in GitHub Desktop.
Override WooCommerce Shipping Cost
<?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