Created
January 27, 2017 21:56
-
-
Save carasmo/3b9159a0294b45c9f8948e5248a254ce to your computer and use it in GitHub Desktop.
Check WooCommerce version using version_compare( WC_VERSION ...
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 | |
| //don't add this above | |
| //change the hook and the function name | |
| function yourprefix_woocommerce_function_does_what() { | |
| if ( ! class_exists( 'WooCommerce' ) ) return; | |
| if ( version_compare( WC_VERSION, '2.7', '>=' ) ) { | |
| //WooCommerce 2.7 or higher | |
| } else { | |
| //2.6.x or under | |
| } | |
| } | |
| add_action( 'some_hook' , 'yourprefix_woocommerce_function_does_what' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment