Skip to content

Instantly share code, notes, and snippets.

@jconroy
Last active August 6, 2022 09:15
Show Gist options
  • Save jconroy/e21c146aefa4301397b65d430f80dc05 to your computer and use it in GitHub Desktop.
Save jconroy/e21c146aefa4301397b65d430f80dc05 to your computer and use it in GitHub Desktop.
POC disable the marketing hub menu item
<?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' );
@erikdemarco
Copy link

what is the difference between 'woocommerce_admin_get_feature_config' and 'woocommerce_admin_features' should i use both? or just one of them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment