Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Created May 22, 2012 08:32
Show Gist options
  • Save mikejolley/2767607 to your computer and use it in GitHub Desktop.
Save mikejolley/2767607 to your computer and use it in GitHub Desktop.
WooCommerce - Default shipping SUB-method 1.5.7/1.6+
add_filter( 'woocommerce_shipping_chosen_method', 'custom_shipping_chosen_method', 10, 2 );
function custom_shipping_chosen_method( $chosen_method, $_available_methods ) {
switch ( $_available_methods[0] ) {
case 'table_rate:0-USPS':
$chosen_method = 'table_rate:0-USPS';
break;
case 'table_rate:1-USPS':
$chosen_method = 'table_rate:1-USPS';
break;
case 'table_rate:2-USPS':
$chosen_method = 'table_rate:2-USPS';
break;
case 'table_rate:3-USPS':
$chosen_method = 'table_rate:3-USPS';
break;
case 'table_rate:4-USPS':
$chosen_method = 'table_rate:4-USPS';
break;
};
return $chosen_method;
}
@mikejolley
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment