Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bolderelements/864e037cb8b7ce94face9ce78578471e to your computer and use it in GitHub Desktop.
Save bolderelements/864e037cb8b7ce94face9ce78578471e to your computer and use it in GitHub Desktop.
Add Custom Condition 'Longest Length' to Cost Types
/**
* Add the longest length to Cost types in Table Rate shipping
* Longest Length is a custom condition added in tutorial:
* https://www.bolderelements.net/support/knowledgebase/adding-new-condition/
*
* Code should be added to theme's functions.php file
*/
function betrs_modify_cost_every( $cost_units_every ) {
// add new condition's value
$cost_units_every['longest_length'] = __( 'Longest Length', 'be-table-ship' );
return $cost_units_every;
}
add_action( 'betrs_shipping_cost_units_every', 'betrs_modify_cost_every', 10, 1 );
function betrs_modify_cost_multiplied( $cost_units_multi ) {
// add new condition's value
$cost_units_multi['longest_length'] = __( 'Longest Length', 'be-table-ship' );
return $cost_units_multi;
}
add_action( 'betrs_shipping_cost_units_multiplied', 'betrs_modify_cost_multiplied', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment