Edit orders: Integer / Float Values
-
Hi WooCommerce support,
We are developing custom software to access the data in WooCommerce via the API provided by WC.
One of the core features of the software is the ability to edit orders, in particular their line items. Of those line items we often need to make the quantity a float value, like 5.2 or 7.6.
When we do it through the WooCommerce interface, we can easily make quantities float values.
However we’ve run into a roadblock, which is that when we try to do the same through the API, we get a 400 error.
Our WordPress installation is in German so forgive the German error message:
{‘code’: ‘rest_invalid_param’, ‘message’: ‘Ungültige(r) Parameter: line_items’, ‘data’: {‘status’: 400, ‘params’: {‘line_items’: ‘line_items[0][quantity] ist nicht vom Typ integer.’}, ‘details’: {‘line_items’: {‘code’: ‘rest_invalid_type’, ‘message’: ‘line_items[0][quantity] ist nicht vom Typ integer.’, ‘data’: {‘param’: ‘line_items[0][quantity]’}}}}}
As you can see, the error from WC is that the quantity is not an integer, in other words float values are not allowed.
But again, when we do it through the web interface, float values are actually allowed.
Could you please help us in working around this issue? An idea we had was maybe some hook/filter we could hook into to override the validation of the quantity parameter using a must-use plugin, but we weren’t sure which hook/filter to use for that.
Could you help us solve this? Or point us in the right direction?
Thank you very much.
The page I need help with: [log in to see the link]
- The topic ‘Edit orders: Integer / Float Values’ is closed to new replies.