• Resolved amrevnc

    (@amrevnc)


    How do I re-enable the WooCommerce API? It was working, and apparently stopped after some changes made a few days ago. I have reverted those changes, but the API is still disabled. Details:

    • The API is shown on the plugin page (Settings> Advanced> REST API). As you know, the only option is to revoke it–that is, there is no indication it is disabled or a way to re-enable.
    • The “Status” page in the plugin shows, on the “Settings? API enabled” row, a dash instead of a check mark (which the Woo documentation suggests should be there).
    • The “/wc-api/v1/” test I found in the documentation returns a message that the API is disabled.
    • Perhaps I missed it, but I can’t find anything in the forum or docs about how to re-enable it.

      Thank you,
      Jim

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi @amrevnc,

    It sounds like this may be using the Legacy REST API. You can enable it. Here’s how:

    * Go to WooCommere > Settings > Advanced > Legacy REST API.
    * Check the box to enable the legacy REST API.
    * Save your changes.

    See if that gets this working for you again. Let us know if you have any trouble.

    Cheers

    Thread Starter amrevnc

    (@amrevnc)

    Thank you for this suggestion. I tried it, and the problem did not resolve.

    Thread Starter amrevnc

    (@amrevnc)

    I have solved the problem. The answer was unintuitive, so I am adding it here for anyone else who runs into it.

    I had made a change in the “functions.php” file of my child theme for an unrelated purpose (a workaround to enable Jetpack to display the social sharing icon for e-mail without using Akismet). Specifically, I added this line at the bottom of the file:

    add_filter( ‘sharing_services_email’, ‘__return_true’ );

    Removing that line fixed the issue. Don’t ask me why. ??

    Thread Starter amrevnc

    (@amrevnc)

    Apparently I lied. The problem has recurred. I tried revoking the old API key and adding a new on, and that did not fix the issue.

    I would be grateful for any help.

    Thread Starter amrevnc

    (@amrevnc)

    Sorry for the multiple posts, but I thought I should share that I experimented with plugins last night without success. Specifically, I:

    1. Turned off W3 Total Cache (after purging all caches)
    2. Set Cloudflare to bypass its cache (that is, load directly from the site server)
    3. One at a time, turned off each plugin not in place the last time the sync worked, and tried the sync
    4. De- and reactivated the Printful plugin (the site I am trying to re-sync with)

    Also note that earlier I created a new WooCommerce API key and revoked the old one.

    After all this, the conditions in my original post remain true.

    Hello again,

    Just to be clear, this error message is generated by the “Legacy API” and not the current version. I can pull up the index for v3 successfully here:

    https://amrevnc.com/wp-json/wc/v3

    Let’s do this, go to https://amrevnc.com/wp-admin/options.php and search for this option:

    
    woocommerce_api_enabled
    

    When it’s enabled, it should show “yes” as the value. If it’s “no” then change it to yes and save your settings at the bottom of the page.

    If that’s not it, there could be something making use of a filter on the site called woocommerce_api_enabled. You could try using the String Locator plugin to find any references to that in the code of the site. If that filter returns false it will override the setting to enable the Legacy REST API.

    Let us know what you find out.

    Thread Starter amrevnc

    (@amrevnc)

    Thank you for your help!

    I don’t have the skills to know what I’m looking at using your “wp-json/wc/v3” link. I do know the plugin was *not* using the Legacy API when everything was working. (I did not check the Legacy API box until you suggested it.) And when I run “/wc-api/v1/” or “”/wc-api/v1/” it returns the API as disabled.

    You made an excellent catch regarding “options.php.” It shows a “no,” and worse, it won’t save the “yes” setting. That is, I enter “yes,” click “Save,” and if I go right back to that line it has reverted to “no.” I tried it twice!

    I also tried the String Locator, but the server returned a 400 Bad Request error. I presume that has to do with the server security settings (a shared server on Dreamhost).

    Any idea what would prevent me from changing that option?

    Best regards,
    Jim

    Thread Starter amrevnc

    (@amrevnc)

    Update: At the suggestion of Dreamhost, I deactivated all of the Woo plugins, Jetpack, and W3 Total Cache. I reactivated just WooCommerce, went to options.php, and was able to change the “no” to “yes.” I then reactivated everything else. Now the “/wc-api/v1/” and “v3” tests shows the API is enabled.

    However, the original problem remains with the vendor plugin not syncing. I will go back to them for that support.

    Thank you for your help.

    Hey @amrevnc,

    Great detective work there. Hopefully they’ll be able to help you troubleshoot.

    Just for clarification, the reason we looked at the Legacy API was because of the URL that was originally mentioned.

    
    /wc-api/v1/
    

    That’s part of the Legacy REST API. The current REST API system follows this format.

    
    /wp-json/wc/v3
    

    If we can help out at all, let us know.

    Cheers

    Hi @amrevnc,

    Since we haven’t heard from you in a while, we’re hoping that means you were able to get this resolved. I’m going to close this thread out now.

    If you’re still having trouble, please open up a new topic and we’ll be happy to help out.

    Stay safe!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Re-enable Woo API’ is closed to new replies.