Title: Plugin breaks WooCommerce Payments
Last modified: October 11, 2020

---

# Plugin breaks WooCommerce Payments

 *  [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/)
 * Besides the missing payment control/status pages when “Disable WooCommerce Admin”
   is enabled (which sure seems to kill analytics the way the world needs!!!), the
   Payment Method itself is also gone, showing red-bar message:
 * “”WooCommerce Payments
 * WooCommerce Payments requires WooCommerce Admin to be enabled. Please remove 
   the woocommerce_admin_disabled filter to use WooCommerce Payments.””
 * Maybe the analytics CPU eater can be killed in a similar way to how you kill 
   the Marketing Hub? I’ll try to dig into it, but it’s a killer for me. 🙁
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fplugin-breaks-woocommerce-payments%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13518390)
 * Well, I think “Payments” works like “Marketing Hub”.
 * I found:
 * plugins/woocommerce/packages/woocommerce-admin/includes/includes/feature-config.
   php
    …… function wc_admin_get_feature_config() { return array( ‘activity-panels’
   => true, ‘analytics’ => true, ‘analytics-dashboard’ => true, ‘analytics-dashboard/
   customizable’ => true, ‘coupons’ => true, ‘devdocs’ => false, ‘marketing’ => 
   true, ‘onboarding’ => true, ‘remote-inbox-notifications’ => false, ‘shipping-
   label-banner’ => true, ‘store-alerts’ => true, ‘unminified-js’ => false, ‘wcpay’
   => true, ‘homescreen’ => true, ); } ……
 * I hacked your lovely plugin to hard-code add (jeez – I’m just testing LOL)
    code
   to the marketing disable code: function disable_features( $features ) { …… $analytics
   = array_search(‘analytics’, $features); unset( $features[$analytics] ); $analytics
   = array_search(‘analytics-dashboard’, $features); unset( $features[$analytics]);
   $analytics = array_search(‘analytics-dashboard/customizable’, $features); unset(
   $features[$analytics] ); $marketing = array_search(‘marketing’, $features); unset(
   $features[$marketing] ); return $features; …… When “WooCommerce Admin” is re-
   enabled, Payments comes back and seems A-OK on front-end, payments section, and
   dashboaard.
 * Unfortunately, the blasted wc-analytics background tasks still trigger. 🙁 🙁
 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13518547)
 * OK, one more step through the swamp.
 * Kill the REST endpoints. Ya, they’ll probably still get called – but should yield
   a 404 and not eat the server. I am see the the call that (I think) triggers the
   REST happening, but I m not seeing any delay in response – and it was a solid
   60+ seconds every time before).
 * HUGE shout out to:
    [https://wpreset.com/remove-default-wordpress-rest-api-routes-endpoints/](https://wpreset.com/remove-default-wordpress-rest-api-routes-endpoints/)
   for the code below. Throw this in somewhere (I have it in my theme/functions.
   php
 * // —————————————————————————
    // Kill the wc-analytics REST endpoints
 * add_filter( ‘rest_endpoints’, ‘kill_wc_analytics_endpoints’ );
 * function kill_wc_analytics_endpoints( $endpoints ) {
    $prefix = ‘wc-analytics’;
 *  foreach ( $endpoints as $endpoint => $details ) {
    if ( !fnmatch( ‘/’ . $prefix.‘/*’,
   $endpoint, FNM_CASEFOLD ) ) { unset( $endpoints[$endpoint] ); } }
 *  return $endpoints;
    }
 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13518644)
 * SO – if all my above checks out from an independent test, I would suggest adding
   support for Woo Payments like for the Marketing Hub, and add the REST endpoint
   killer shown above as a new quick option – that may be useful across the board.
 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13522012)
 * ARRGGHH.
    The snippet to kill the wc-analytics endpoint as posted above has a
   stray bang (!) in front of the fnmatch – remove it.
 * The original snippet is set to keep ONLY the prefixed items while we want to 
   keep all BUT the prefix.
 * Sorry about that chief!
 *  Plugin Contributor [ospiotr](https://wordpress.org/support/users/ospiotr/)
 * (@ospiotr)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13567152)
 * Hi [@simonkane](https://wordpress.org/support/users/simonkane/)
 * I was struggling to remove specific WC Admin features without removing other,
   but I didn’t work it out yet 🙁
 * I’ve been trying to use [this technique](https://gist.github.com/isaumya/89f48dcd84cb58af1e668bb76ba2c029).
   If you manage to achieve this somehow, please let me know!
 * I’m marking this thread as resolved for now.
 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13570481)
 * Hi!
 * I think I already addressed this above.
    [https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13518390](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13518390)
   1. I found “wc_admin_get_feature_config” 2. I found how to kill the Analytics
   items (the ‘unset’s that I dropped into the “wrong” place (function disable_features)
   for testing – as I mentioned. The last 3 lines (first is $marketing ….) are yours.
 * If you clone your “kill marketing” feature (renames as needed), add the feature
   control, and use my unset code.
 * Same concept with other features in that first list – I would think.
 * THEN – the big fix (kills the background server-killing tasks) is my ‘kill_wc_analytics_endpoints’
   filter —
    just don’t forget to remove that stray bang (!) in front of the fnmatch.
 * I think I would implement that as a separate sub-feature of the “kill analytics”
   new feature that is a clone of “kill marketing”.
 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13574217)
 * To state it another way, the Woo Admin Dashboard infrastructure is needed to 
   allow various other features like “Woocommerce Payments”.
 * So – using the master “Disable” checkbox can not be used by everybody.
 * Having granular controls (Marketing, Analytics, Payments, etc.) keeps some of
   the bloat away – but the big monster seems to be the REST API calls – which I
   solved above.
 *  Thread Starter [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * (@simonkane)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13606449)
 * I found something else. My mod breaks the Woo Customers table.
    At least I think
   it’s my fault. Probably due to killing the wc-analytics REST API.
 * If you “Disable WooCommerce Admin” via the checkbox, the “Customers” option disappears
   entirely. So, if I/we want to keep using “WooCommerce Payments” cleanly, I/we
   should find a way to kill the “Customers” menu option of Woo without using the“
   Disable WooCommerce Admin” feature. This will avoid users seeing the error you
   get.
 * Any idea where that lives? And/or any other analysis of how to kill the resource
   hog background tasks besides my method?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Plugin breaks WooCommerce Payments’ is closed to new replies.

 * ![](https://ps.w.org/disable-dashboard-for-woocommerce/assets/icon-256x256.png?
   rev=2822447)
 * [Disable Bloat for WordPress & WooCommerce](https://wordpress.org/plugins/disable-dashboard-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/disable-dashboard-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/disable-dashboard-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/disable-dashboard-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/disable-dashboard-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/disable-dashboard-for-woocommerce/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Simon Kane](https://wordpress.org/support/users/simonkane/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/plugin-breaks-woocommerce-payments/#post-13606449)
 * Status: not resolved