Skip to content

Instantly share code, notes, and snippets.

@bolderelements
Created May 25, 2018 14:30
Show Gist options
  • Save bolderelements/c6fb492e15ce4a49bae9fe60c2a5d4ae to your computer and use it in GitHub Desktop.
Save bolderelements/c6fb492e15ce4a49bae9fe60c2a5d4ae to your computer and use it in GitHub Desktop.
Modify the Order Weight for Table Rate Shipping Settings
/*
* Adds additional weight to cover packaging costs.
*
* Requires Table Rate Shipping 4.2+
*/
function betrs_add_packaging_weight( $calculated_totals, $items ){
// weight to add
$add_weight = 350; // change this value to weight needed
// add weight to calculated totals
$calculated_totals['weight'] += $add_weight;
return $calculated_totals;
}
add_filter( 'betrs_calculated_totals-per_order', 'betrs_add_packaging_weight', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment