woocommerce / woocommerce-legacy-rest-api

The legacy WooCommerce REST API, which used to be part of WooCommerce itself but is removed as of WooCommerce 9.0.
10 stars 11 forks source link

Add a dismissable admin notice indicating that the Legacy REST API is not compatible with HPOS #9

Closed Konamiman closed 5 months ago

Konamiman commented 6 months ago

The notice will appear if the orders table is (or has been) selected as the orders data store in the WooCommerce features settings page, and will disappear when that ceases to be true. Once the notice is dismissed it will never appear again.

image

How to test

  1. Start with the latest trunk of WooCommerce.
  2. Make sure that the legacy REST API is disabled (WooCommerce - Settings - Advanced - Legacy API) and that HPOS is disabled (WooCommerce - Settings - Advanced - Features, select posts table as the orders data store).
  3. Activate the plugin in the branch of this pull request. If you need a zip file for the plugin you can generate one checking out the branch of this pull request and running git archive -o woocommerce-legacy-rest-api.zip HEAD.
  4. Verify that no admin notices appear.
  5. Enable the legacy REST API and HPOS. Now the notice should appear.
  6. Disable the legacy REST API. The notice will disappear.
  7. Enable again the legacy REST API and disable HPOS. Again the notice isn't there.
  8. Enable HPOS again. The notice is back.
  9. Dismiss the notice. Verify that it doesn't appear again no matter what you do with the legacy REST API and HPOS settings.
  10. Verify that the legacy REST API continues to function as usual, e.g. query http://localhost/wc-api/v3/orders.
  11. Switch WooCommerce to the branch of https://github.com/woocommerce/woocommerce/pull/40627 and repeat the tests (note that now you can't disable the legacy REST API, so only test enabling and disabling HPOS).

Note: run this if you want to undo the notice dismissal:

 wp user meta delete <your user id> "dismissed_legacy_rest_api_is_incompatible_with_hpos_notice"
Konamiman commented 5 months ago

not that we have published our goodbye should we link it using the filter we added in the core PR?

I think that all the notices and warnings we've added through time in WooCommerce core, which all point to the original announcement, should be enough.