Created
October 28, 2019 14:00
-
-
Save bolderelements/864e037cb8b7ce94face9ce78578471e to your computer and use it in GitHub Desktop.
Add Custom Condition 'Longest Length' to Cost Types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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