• Resolved ddons

    (@ddons)


    When editing or creating new products when manage stock is selected there is a low stock threshold field. I can edit it manually and it works.

    Is there a way to update this field via API because i cant find the endpoint in the WooCommerce API documentation.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @ddons ,

    Thanks for reaching out!

    I checked the documentation and response from the WooCommerce products. The response does not include the low stock threshold field information.

    If you have plan to extend the REST API response data, you can use this filter – woocommerce_api_product_response

    Thank you ??

    Thread Starter ddons

    (@ddons)

    Hello @rur165,

    So by using “woocommerce_api_product_response” filter I could add “low stock threshold” to my response data while fetching the product information?

    More importantly, is there a way to extend the API so that I could update the “low stock threshold” product information on the website instead of just being able to collect data?

    EDIT: where should I insert the “woocommerce_api_product_response” filter and its function, filepath?

    Thank you for the response.

    • This reply was modified 4 years ago by ddons.
    • This reply was modified 4 years ago by ddons.
    • This reply was modified 4 years ago by ddons.

    Hello @ddons ,

    According to the documentation, these filters should allow you to get additional information with the API requests.

    I tried to search further and it seems you should use a different filter – woocommerce_rest_prepare_product_object to extend the API.

    You can see an example code for this here – https://stackoverflow.com/a/61446521

    All of these can be added via your theme’s functions.php file or a snippet plugin.

    Thank you ??

    Thread Starter ddons

    (@ddons)

    Hi @rur165 ,

    I managed to add low_stock_threshold value to the API response when retrieving product data as suggested here https://stackoverflow.com/a/61446521.

    However, I need to SEND/POST data to that product field via API and I can’t figure it out.

    Thank you.

    Hi there,

    I am glad to know that the example code helped you progress.

    Since I do not have an exact example code for POST custom data through API, I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    If you need a paid solution, you can consider taking help from one of our partner’s website.

    Thank you ??

    Hi there,

    We’ve not heard back from you in a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Thank you ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WooCommerce Low Stock Threshoold Per Product’ is closed to new replies.