Goodbye, Legacy REST API

This post is a friendly reminder that the Legacy REST API will be removed in WooCommerce 9.0, which is scheduled for release on June 11, 2024.

For most of our users this should not present any sort of problem but, for any users who do still depend on the Legacy REST API, we have prepared a separate plugin that you can install to provide some additional time in which to transition.

Confused, or needing extra help figuring this out? Please read on 🙂

What is the Legacy REST API?

WooCommerce provides a REST API allowing other systems to ‘talk to’ and exercise control over your online store. For example, you might decide to integrate a shipping service with your store, and the REST API would provide a way for them to update order statuses, as and when products are shipped to customers.

There are actually several supported versions of the WooCommerce REST API, and we are only removing some very old versions that have now been deprecated for many years.

Am I using the Legacy REST API?

This is the key question because, if you are not using the Legacy REST API, you can simply move on without worrying about this change.

A great initial step is to visit WooCommerce ▸ Settings ▸ Advanced ▸ Legacy REST API and check if the legacy system is enabled: if it is not enabled, you have nothing else to worry about, and can stop reading. In other cases it may be enabled, but you may be unsure if it is actually being used and if you can simply disable it.

To help make it as easy as possible to answer this question, recent versions of WooCommerce (8.5 onwards) actively detect if the Legacy REST API is being used, and will display an admin notice looking something like this:

Example of an admin notification warning that the WooCommerce Legacy REST API appears to be in active use.

You can then follow the link to the log files, and gather additional information. For example:

Example of a log entry, containing information about a recent use of the Legacy REST API.

In the above example, we see the following in the log entry:

  • Route: /customers/count → information about customers is being accessed.
  • shipshapeshipping/1.2.3 → a clue as to the service making the API requests (here, a fictional shipping provider called Shipshape Shipping).

Based on this information, you can make contact with the relevant service provider and ask them about their plans to transition to a currently supported version of the REST API.

Other ways to determine if the Legacy REST API is being used

We also recommend that you visit the WooCommerce ▸ Settings ▸ Advanced ▸ Webhooks screen. If you see one or more active legacy webhooks, as in the following screenshot, then it is likely you still need the Legacy REST API:

Shows the list of legacy webhooks.

Finally, you may find it helpful to visit the WooCommerce ▸ Settings ▸ Advanced ▸ REST API screen. This contains a list of generated API keys and, if nothing is listed here, that suggests that you don’t need to worry about external services using the legacy API. In other words, it is almost certainly safe to disable the Legacy REST API if:

  • You don’t have any legacy webhooks
  • And you don’t have any API keys

On the other hand, if you do see API keys listed there, you may be able to glean hints as to what service is using them based on the descriptions assigned to each key … but unfortunately it is not possible to tell if they are exclusively used for legacy API purposes or not. However, so long as you update to WooCommerce 8.5 or greater, you should be able to take advantage of the detection system described above.

Installing the Legacy REST API plugin

For those of you who need more time to transition, we recommend that you install and activate the Legacy REST API plugin, available in the official WordPress plugin directory:

wordpress.org/plugins/woocommerce-legacy-rest-api

In fact, as of WooCommerce 8.8, if the system believes that you need this plugin you may find it has already been installed for you:

Shows the admin screen listing installed plugins, complete with the Legacy REST API plugin and notices informing the user that it was installed automatically.

You can learn more about automatic installation of this plugin in this announcement, which also provides guidance for those wishing to block installation.

I have the legacy plugin, what next?

We do not plan on supporting the Legacy REST API plugin indefinitely, and strongly recommend transitioning to currently supported versions of the REST API (the current stable version is version 3).

In most cases, we expect that this is actually in the hands of various third party services you have decided to integrate with, so you should do your best to reach out to them and ask about their plans for transitioning.

Additionally, the Legacy REST API is not currently compatible with High-Performance Order Storage (HPOS). If you need to use both, please be sure to visit WooCommerce ▸ Settings ▸ Advanced ▸ Features (you can also use the information in this screen to find out if HPOS is enabled) and turn on Compatibility Mode.

Last but not least, you may simply wish to install the legacy plugin for extra safety. There is absolutely nothing wrong with this, but please watch out for notifications and log entries alerting you to actual Legacy REST API usage, as described above: if you find that some weeks or months roll by without any usage being detected, that is a reasonable indication that it is safe to remove the plugin.

As ever, we’re here to help. Let us know if we can clarify anything or provide additional guidance.


Keep yourself in the loop!

This field is hidden when viewing the form
This field is hidden when viewing the form
This field is hidden when viewing the form


8 responses to “Goodbye, Legacy REST API”

  1. Diego Avatar

    Despite being “Mr Don’t Change Anything” at times, I welcome this change. Now it will be interesting to see how many external services will have to rush to keep up with it. I’ve come across at least four major service providers that, no more than a few months ago, still relied on the V1 of the legacy REST API. I will remain on standby, perhaps I can help them with the migration.

    1. Ricardo Avatar
      Ricardo

      It’s even crazier to me how are they still using that if the new REST API was made available in 2016…

  2. Karolina Avatar
    Karolina

    Hello,

    My site is crashing after Legacy Rest API has been automatically installed. I don’t recall using rest api, there are no hoods or API keys. But the Legacy API is enabled and I can see it in logs. Can I safely disable Legacy API and deactivate Legacy Rest API plugin? The site keeps crashing and customers cannot process payments, it says session expired on the checkout page.

    Thanks

    1. Barry Hughes Avatar
      Barry Hughes

      If you don’t have any services that depend on it then, yes, you can certainly disable it and remove the plugin.

      But the Legacy API is enabled and I can see it in logs.

      I’m not completely clear as to what you are seeing in the logs, though. Can you provide any more details?

      If, for instance, you are seeing logged information about Legacy REST API requests, as described in this article (screenshot), that indicates a service you are connected with is using this system.

  3. When i try to install the legacy plugin i get this error…

    Fatal error: Uncaught Error: Class “WC_Legacy_API” not found in /home/sweatrscimagery/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php:19 Stack trace: #0 /home/sweatrscimagery/public_html/wp-content/plugins/woocommerce/includes/class-wc-autoloader.php(54): include_once() #1 /home/sweatrscimagery/public_html/wp-content/plugins/woocommerce/includes/class-wc-autoloader.php(98): WC_Autoloader->load_file(‘/home/sweatrsci…’) #2 [internal function]: WC_Autoloader->autoload(‘wc_api’) #3 /home/sweatrscimagery/public_html/wp-content/plugins/woocommerce-legacy-rest-api/includes/class-wc-legacy-rest-api-plugin.php(146): class_exists(‘WC_API’) #4 /home/sweatrscimagery/public_html/wp-content/plugins/woocommerce-legacy-rest-api/includes/class-wc-legacy-rest-api-plugin.php(62): WC_Legacy_REST_API_Plugin::legacy_api_still_in_woocommerce() #5 /home/sweatrscimagery/public_html/wp-includes/class-wp-hook.php(324): WC_Legacy_REST_API_Plugin::on_plugin_activated(”) #6 /home/sweatrscimagery/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(”, Array) #7 /home/sweatrscimagery/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #8 /home/sweatrscimagery/public_html/wp-admin/plugins.php(196): do_action(‘activate_woocom…’) #9 {main} thrown in /home/sweatrscimagery/public_html/wp-content/plugins/woocommerce/includes/class-wc-api.php on line 19

    1. Barry Hughes Avatar
      Barry Hughes

      That sounds a lot like the problem described here. Although, I’m a little surprised to hear it is being triggered because of the installation of the Legacy REST API plugin.

      If you recently updated to WooCommerce 9.0, can I suggest as an initial step that you try re-installing it? To do this, simply grab the latest version of WooCommerce and download it to your local computer. Then, navigate to Plugins ‣ Add New Plugin ‣ Upload Plugin, and upload the zip.

      You’ll be asked to confirm that you wish to overwrite the existing plugin: agree to this, and continue. Does that solve the problem in your case?

  4. “The Legacy REST API plugin and HPOS are both active on this site.

    Please be aware that the WooCommerce Legacy REST API is not compatible with HPOS”

    Clicking any links with this notice just sends me to the October 2023 post. And judging from the comments, a lot of people are finding instructions unclear.

    I need to know the following…
    1) The link in the HPOS notice sends me to the Features in Woo’s Advanced settings. Do I enable another setting here?

    2) OR, do I go to REST API in Advanced Settings and add a new key? What should I use for permissions on that? Read, Write, Both?

  5. Barry Hughes Avatar
    Barry Hughes

    Hi Jenn,

    It does seem people are finding the instructions unclear, we’re sorry about that.

    1) The link in the HPOS notice sends me to the Features in Woo’s Advanced settings. Do I enable another setting here?

    If you need to use both the Legacy REST API and HPOS, please be sure to visit WooCommerce ▸ Settings ▸ Advanced ▸ Features and turn on Compatibility Mode.

    2) OR, do I go to REST API in Advanced Settings and add a new key?

    There’s no need to do this. If you have previously shared a key with a service that uses the Legacy REST API, that same key will continue to work as long as you have the Legacy REST API plugin enabled (and it will also work if they switch from the Legacy REST API to the currently supported API).

    Does that help?

Leave a Reply

Your email address will not be published. Required fields are marked *