-
-
Save jconroy/e21c146aefa4301397b65d430f80dc05 to your computer and use it in GitHub Desktop.
POC disable the marketing hub menu item
This file contains 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 | |
/** | |
* Plugin Name: Disable the WooCommerce Marketing Hub | |
*/ | |
/** | |
* Option - Remove marketing features - basic example to demonstrate usage | |
*/ | |
add_filter( | |
'woocommerce_admin_get_feature_config', | |
function ( $features ) { | |
$features['coupons'] = false; | |
$features['marketing'] = false; | |
return $features; | |
} | |
); | |
/** | |
* Option - Remove marketing features - basic example to demonstrate usage | |
*/ | |
add_filter( 'woocommerce_admin_features', 'disable_features' ); | |
function disable_features( $features ) { | |
$marketing = array_search('marketing', $features); | |
unset( $features[$marketing] ); | |
//$coupons = array_search('coupons', $features); | |
//unset( $features[$coupons] ); | |
//array_values( $features ); | |
return $features; | |
} | |
/** | |
* Add/edit additional marketing hub menu item/s | |
*/ | |
//add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' ); | |
/** | |
* Remove wc-admin | |
*/ | |
//add_filter( 'woocommerce_admin_disabled', '__return_true' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is the difference between 'woocommerce_admin_get_feature_config' and 'woocommerce_admin_features' should i use both? or just one of them?