• Resolved jorensm

    (@jorensm)


    when I try to make a GET request to the products endpoint, I receive an empty array. I tried with Postman as well as with a PHP script, but both return an empty array. When I do a POST request to the same endpoint, I get a response with the newly created product. But GETting just returns an empty array

    Screenshot of Postman request: https://imgur.com/a/pscVQOQ

Viewing 4 replies - 1 through 4 (of 4 total)
  • Saif

    (@babylon1999)

    Hello @jorensm,

    First, please check if the API key has Read and Write permissions.


    Link to image: https://d.pr/i/t7wIdr

    If that doesn’t work, then you might have a plugin/theme conflict.

    ?
    The best way to determine this is to:

    • Temporarily switch your theme to Storefront
    • Disable all plugins except for WooCommerce
    • Repeat the action that is causing the problem

    If you’re not comfortable doing all of this on the live version of your site, you can create a staging environment using WP-STAGING.

    If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated. To figure out which plugin is causing the problem, reactivate your other plugins one by one, testing after each, until you find the one causing conflict. You can find a more detailed explanation on how to do a conflict test here.

    Let us know how it goes!

    Thread Starter jorensm

    (@jorensm)

    @babylon1999 Thanks for your response. I installed a fresh version of WordPress + WooCommerce locally, and when I called endpoint to that website, it worked. So it must be a theme/plugin conflict.

    Thread Starter jorensm

    (@jorensm)

    I found the problem – it was my own custom plugin that I wrote for the website, it was altering the WP_Query object. I disabled the plugin and then the endpoint worked fine! Thanks for your help @babylon1999 !

    Saif

    (@babylon1999)

    Thank you sharing the solution with the community! ??</img>

    I can see you’ve already switched the thread to solved. If you have a few minutes, we’d love it if you could leave us a review: https://www.ads-software.com/support/plugin/woocommerce/reviews/

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘REST API products endpoint returns empty array’ is closed to new replies.