Last active
December 21, 2015 22:59
-
-
Save woogist/6379275 to your computer and use it in GitHub Desktop.
Measurement Price Calculator sample code for adding a custom unit
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
<?php | |
add_filter( 'woocommerce_catalog_settings', 'add_woocommerce_dimension_unit_league' ); | |
/** | |
* This adds the new unit to the WooCommerce admin | |
*/ | |
function add_woocommerce_dimension_unit_league( $settings ) { | |
foreach ( $settings as &$setting ) { | |
if ( 'woocommerce_dimension_unit' == $setting['id'] ) { | |
$setting['options']['league'] = __( 'League' ); // new unit | |
} | |
} | |
return $settings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment