WooCommerce – building a custom api

For specific product needs, I am creating a custom api for my application to query WooCommerce.

I am able to hook into the ‘parse_request’ action, but it would seem that this is too early for woocommerce to be correctly setup.

Read More

I know this because if I try to query for order information, I am getting back error objects saying that taxonomie is incorrect.

What do I need to do to correctly have woocommerce initialised so that I can query for orders and products (along with their custom attributes) ?

Can anyone help me with this ?

Related posts

Leave a Reply

1 comment

  1. I’m not sure I fully understand what you are trying to do so I will attempt to cover both possibilities.

    The WooCommerce API can be accessed via https://www.example.com/wc-api/v1/.

    Alternatively, WooCommerce is fully loaded by the time plugins_loaded is fired (aka when all plugins are done loading). To do something specifically when WooCommerce is loaded you can use woocommerce_loaded. But parse_request comes after plugins_loaded and even comes after init which is where WooCommerce is loading its taxonomies. Are you sure you are using the correct taxonomy names? For example, Attribute taxonomies are preceded by pa_ so a Color attribute would have a taxonomy of pa_color.

    If you adjust your question to clarify what you are doing I might be able to help further.