Skip to content

Instantly share code, notes, and snippets.

@quasel
Forked from mikejolley/gist:67580b9e8b1c2ed1081f
Created March 23, 2016 20:38
Show Gist options
  • Save quasel/892596c16f1503c364b2 to your computer and use it in GitHub Desktop.
Save quasel/892596c16f1503c364b2 to your computer and use it in GitHub Desktop.
add_action( 'woocommerce_flat_rate_shipping_add_rate', 'add_another_custom_flat_rate', 10, 2 );
function add_another_custom_flat_rate( $method, $rate ) {
$new_rate = $rate;
$new_rate['id'] .= ':' . 'custom_rate_name'; // Append a custom ID
$new_rate['label'] = 'Rushed Shipping'; // Rename to 'Rushed Shipping'
$new_rate['cost'] += 2; // Add $2 to the cost
// Add it to WC
$method->add_rate( $new_rate );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment