• Resolved samleemc

    (@samleemc)


    Hi,

    I am trying to build a ERP system for a seafood shop who is selling online using WooCommerce.

    However, when we try to update the weight, aka the quantity, of a fish, the WooCommerce Web portal allow user to enter decimal. However, the Restful API doesn’t allow us to send decimal quantity.

    Is there any way to allow the API to accept decimal quantity for order line items?

    I saw there are some thread that related to decimal quantity, but most are related to stock, but mine problem focus on the type validation of the restful API instead.

    Thanks a lot!

    Sam

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    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!

    Thread Starter samleemc

    (@samleemc)

    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

    Plugin Support Zubair Zahid (woo-hc)

    (@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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.