Hi @samleemc,
Thank you for reaching out.
I understand your requirement to update decimal quantities for your seafood shop’s ERP system using WooCommerce’s REST API.
Unfortunately, WooCommerce’s REST API currently doesn’t support decimal quantities for order line items. It’s designed to work with integers, as it’s primarily used for products that are sold in whole quantities. You can find more information here.
However, you may consider using a workaround by multiplying your quantities by a factor of 10 or 100 (or any other suitable factor) while sending the data, and then divide it by the same factor after receiving it. This way you can maintain the decimal precision you need.
Please note that this is a workaround and might require additional handling in your ERP system. We also recommend testing this thoroughly before implementing it in a live environment.
I hope this helps!
hi @ckadenge ,
Thanks for coming back to us. If we are using the latest checkout block (not sure if it ever is related), what is/are the best hook we should use to process the api request before the data is write back to the database and trigger other workflow?
Sam
Zee
(@doublezed2)
Hello samleemc,
Thank you for your reply.
Your question seems to involve custom code, which falls outside the scope of our support.
I recommend asking in developer communities like the Woo Community Facebook group or Woo Community Slack, where fellow developers may be able to assist you with the best hooks for processing API requests in the checkout block.
Please don’t hesitate to contact us again if you have more questions or concerns.
We are here to help 🙂
Best regards.