Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Disabling wc-admin: Repurpose filter to remove optional features #7232

Merged
merged 5 commits into from Jul 1, 2021

Conversation

psealock
Copy link
Collaborator

The previous attempt to remove the woocommerce_admin_disabled revealed some great feedback about why it was being used in #6568.

This pull requests attempts to honour those use cases by turning off optional features of wc-admin which, as of now, are Navigation and Analytics. By turning off Analytics, this removes Reports, associated API's, data stores, and order processing. This allows WooCommerce to continue being a lean CMS delivering only content without including extensive reporting.

Detailed test instructions:

  1. Make sure all optional features are turned on via the UI WooCommerce > Settings > Advanced > Features

Screen Shot 2021-06-24 at 1 14 18 PM

  1. Add add_filter( 'woocommerce_admin_disabled', '__return_true' ); to an external plugin.
  2. Go to WooCommerce and confirm Analytics and Navigation aren't available.
  3. Optionally, make a request to /wp-json/wc-admin/features and confirm those features are excluded.

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tested well and changes look good, just wondering about one thing:

When we set the add_filter( 'woocommerce_admin_disabled', '__return_true' ); filter, should we also filter out the navigation & analytics feature options within WooCommerce > Settings > Advanced > Features?
It feels weird to still be able to toggle them, although it won't change anything because of the woocommerce_admin_disabled being enabled.

@louwie17 louwie17 added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed status: needs review labels Jun 29, 2021
@psealock
Copy link
Collaborator Author

It feels weird to still be able to toggle them, although it won't change anything because of the woocommerce_admin_disabled being enabled.

I thought about this and agree with this. Even if the merchant toggles, it won't have an effect. What if we disable the toggle and display some sort of message to that effect? That could prevent some confusion, I will work on this today.

@psealock psealock force-pushed the fix/disable-wc-admin-filter branch from cbc3c73 to 8f58e01 Compare June 30, 2021 02:25
@psealock
Copy link
Collaborator Author

8f58e01 changes the feature option section to reflect disabled WC Admin. What do you think @louwie17 ?

Screen Shot 2021-06-30 at 2 24 23 PM

@psealock psealock added status: needs review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jun 30, 2021
Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8f58e01 changes the feature option section to reflect disabled WC Admin. What do you think @louwie17 ?

Hey @psealock I think this looks great, I like the WooCommerce features have been disabled. note.
I just have one small suggestion, could we either hide or disable the Save changes button?

readme.txt Outdated
- Fix: Currency display on Orders activity card on homescreen #7181
- Fix: Report export filtering bug. #7165
- Fix: Use tab char for the CSV injection prevention. #7154
- Tweak: Revert Card component removal #7167
- Tweak: Repurpose disable wc-admin filter to remove optional features #7232
- Tweak: Revert Card component removal #7167
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changelog is already present and can be removed, same goes for the change on line 100.

@louwie17 louwie17 added needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. and removed status: needs review labels Jun 30, 2021
@psealock
Copy link
Collaborator Author

Good suggestion, I wasn't sure that was possible but you can.

Screen Shot 2021-07-01 at 11 16 51 AM

In d709f8c I directly edit the $GLOBALS array to remove the save button when features are disabled. See the check in core here. Something feels dirty about this approach. @joshuatf Do you know if there is a more WP or better way to do this?

if ( $features_disabled ) {
	$GLOBALS['hide_save_button'] = true;
}

@psealock psealock added status: needs review and removed needs: author feedback The issue/PR needs a response from any of the parties involved in the issue. labels Jun 30, 2021
@joshuatf
Copy link
Contributor

@joshuatf Do you know if there is a more WP or better way to do this?

It would be great if there was a filter here, but I don't believe there is and AFAIK core does this the same way so I think it's the best available solution 👍

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 😄 I appreciate the extra changes @psealock, it looks and tests great 🚀

$GLOBALS['hide_save_button'] = true; indeed feels a bit strange, but it sounds like we got Josh's approval 👍 (I double checked if the save button was still present on other pages, just incase 🤣 )

@bighippo999
Copy link

Hi Guys,

Question, in the first screenshot there's an option 'Adds the new WooCommerce Navigation experience to the dashboard'. Is this the homepage, homepage menu item, inbox and the breadcrumb bar? If so why was this option dropped? and will it be brought back?

We have no use for these on our stores and until today the Disable WooCommerce Bloat Plugin hid it all away and let us get straight into the orders screen. I've now got a bunch of angry people still clicking WooCommerce to refresh the orders screen and landing on the homepage. May not seem like much but it's all time that adds up.

Cheers,

@joshuatf
Copy link
Contributor

Hi @bighippo999 - the experimental navigation is not the same as the homepage or breadcrumb bar. I'm not sure there ever was an option to disable those features individually; only the woocommerce_admin_disabled filter to disable all workings in WooCommerce Admin.

Because much of the code in this repo is being used by WooCommerce core (e.g., onboarding experience) blindly turning off all the code from this package could result in problems.

If you have individual features you'd like to see behind feature toggles, please do open a new issue with the features you'd like to be able to toggle and we can look into putting them behind feature flags where possible.

@bighippo999
Copy link

Thanks for the reply @joshuatf. Not the answer I was hoping for but it's an answer :)
Sadly it's only today after upgrading and being hit with the homepage/breadcrumb again and searching for info that I found this change and the RFC that's closed for comments.
The most general feedback I'd have given is that the new admin slowed our websites, I believe due to the new analytics as others have said but no real way of knowing or proving this. For us the homepage, inbox, analytics, marketing and even the onboarding aren't used or needed. While as your put it blindy turning off all the new admin wasn't the best solution it was the only option of all or nothing when WC Admin was first added to core.

Today I've been trying to find info on what exactly the woocommerce_admin_disabled does affect. This would help to be able to list features I'd like to see behind feature toggles. Sadly it's a battle of getting through lots of info on just applying the filter to disable the new admin with very little detail of all that it affects. So I'm at a loss of building a list beyond homepage and breadcrumb bar that's the most prominent/visible for us today but I think generally I'd like to see all features have an option so that those like us who don't need/use them can turn them off without relying on 3rd party plugins to disable bits of core that may have a larger affect.

I will continue to try to find more info and build a list for features toggles I'd like to see.
Again thanks for taking the time to reply.

ObliviousHarmony pushed a commit to woocommerce/woocommerce that referenced this pull request Mar 18, 2022
…commerce/woocommerce-admin#7232)

* Repurpose disable filter to remove optional features

* changelog

* disable feature toggles on wc-admin disabled

* dedupe changelog

* hide save button using
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants