• Resolved Jason Ryan

    (@viablethought)


    Hello –

    It has been years that I have needed this along with others, I have a client who runs a Garden Center that is selling products like Mulch and Stone and sells them by the yard or the ton. For products that are sold by the yard, the quantity steps are 0.5 and the products sold by the ton are quantity steps by 0.1

    This has been working from the past couple years using the patch described in the linked Github post. We have been manually updating WooCommerce files every single update for over 2 years now and it has grown increasingly frustrating that this has not been resolved yet.

    Now, we’re not sure if something was changed in recent updates that have caused this to stop working, but in our Rest API logs, we are getting a 400 Status when these types of products are attempting to sync with our client’s Clover POS system, with a message saying:

    {
        "data": {
            "code": "rest_invalid_param",
            "message": "Invalid parameter(s): stock_quantity",
            "data": {
                "status": 400,
                "params": {
                    "stock_quantity": "stock_quantity is not of type integer."
                },
                "details": {
                    "stock_quantity": {
                        "code": "rest_invalid_type",
                        "message": "stock_quantity is not of type integer.",
                        "data": {
                            "param": "stock_quantity"
                        }
                    }
                }
            }
        },
        "headers": {
            "Allow": "GET, POST, PUT, PATCH, DELETE"
        },
        "status": 400
    }

    Was something changed recently that would cause a conflict with the linked patch? Or is there something else going on?

    Also, when is this ever going to be changed/updated in WooCommerce core to allow decimals in quantity fields for products?

    Thanks

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @viablethought

    The error message you’re encountering indicates that the system expects the “stock_quantity” to be an integer. However, you’re using decimals for certain products, so the system returns a 400 status error.

    As for your question about recent changes, it’s possible that updates to WooCommerce or the REST API could have affected the functionality of your patch. I recommend checking the version history of both to see if any changes could have impacted this.

    Regarding the ability to use decimals in quantity fields for products, this is currently not a feature in WooCommerce core. We understand that this is a much-needed feature for businesses like yours that sell products by weight or volume. That’s why we recommend you to submit a request on our Ideas Board and cast your vote. The more votes an idea receives, the higher it climbs on our developers’ priority list for review. You can find the Ideas Board here: https://github.com/woocommerce/woocommerce/blob/trunk/.github/CONTRIBUTING.md#feature-requests

    In the meantime, you might consider using a plugin that allows decimal quantities, like the WooCommerce Quantity Increment or Decimal Product Quantity for WooCommerce plugin. This could potentially solve your problem without needing to update WooCommerce files manually.

    I hope this provides some clarity on the matter. If you have any other questions or need further assistance, please don’t hesitate to ask.

    Thread Starter Jason Ryan

    (@viablethought)

    We are already using a plugin to allow for decimals for Product Quantities: Min Max Default Quantity for WooCommerce

    Again, this issue more or less pertains to WooCommerce Core and how this was posted on the repository almost 3 years ago with others needing this functionality and nothing has been done about it by Woo, and just to push folks over to an “idea board” where it will go on for another 3 years without anything being done about it leaves me scratching my head because this limits Woo’s capabilities and the types of stores that may be attracted to using Woo over another product.

    Customers right now with the help of the above-mentioned plugin can purchase products on the site just fine, it is the syncing of inventory between Woo and the customer’s in-store POS system utilizing the REST API – which there is no plugin for to “fix” this issue – and this is where Woo is failing.

    Plugin Support katerinaz – a11n

    (@katerinaz)

    Hey there @viablethought
    We understand your sentiment here. However, we focus on prioritising solutions for issues that affect a significant amount of our users and in relation to mainly WooCommerce products and integrations the have been initiated by us.
    > ?it is the syncing of inventory between Woo and the customer’s in-store POS system utilizing the REST API
    I am afraid that there is not much we can do on our end here since this is in relation to an integration via REST API to a product outside of the WooCommerce realm (Clover POS) and with the use of a third party product (https://wpfactory.com/item/product-quantity-for-woocommerce/) which might also be contributing to the issue (we are not familiar with how exactly this plugin works and how it could interfere).
    We suggest you discuss this with the Clover POS team. Perhaps they might have workarounds or other solutions for your use case.
    You can also try the WooCommerce solution (?WooCommerce Quantity Increment?) to see if it makes any difference whatsoever.
    I also noticed that you said:
    > sells them by the yard or the ton
    If they sell them by the yard or the ton and need to calculate the price, then a Measurement Price Calculator might be a better solution than tampering the actual quantity field: https://woocommerce.com/products/measurement-price-calculator/
    Perhaps that would work better in your case.
    I hope the above info helps.

    Thread Starter Jason Ryan

    (@viablethought)

    Hello @katerinaz

    Thanks for the information but everything outlined by me has been working for the past 3 years just fine until a recent update of Woo.

    Everything on the website is working 100% fine, with the exception of products with decimal values not being able to sync their inventory levels. Products with “whole number” inventory levels are syncing fine between the site and Clover.

    Aside from syncing products, orders, and inventory, customers are able to purchase bulk materials on the site (0.5 yards of black mulch), shows in the order details as 0.5, and in the generated invoice as 0.5. Pricing is being calculated just fine as well.

    It is failing via REST API. That is it.

    Plugin Support wpnomad a11n

    (@wpnomad)

    Hi there,

    Thanks for the information but everything outlined by me has been working for the past 3 years just fine until a recent update of Woo.

    I understand the situation must be frustrating for you, however, things, integrations and customizations that were working fine may break with updates. I’d recommend getting your site reviewed by a developer so they can customize the site to get the previous functionality back.

    Thread Starter Jason Ryan

    (@viablethought)

    We wound up writing a custom plugin that modifies the “stock_quantity” field’s data type to “number” in the WooCommerce REST API schema and got it working again.

    Should seriously consider making this part of core.

    Thanks

    Plugin Support wpnomad a11n

    (@wpnomad)

    Hi @viablethought,

    Happy to know you were able to resolve this with a custom plugin. WooCommerce is open source software developed, updated and maintained by community of developers around he world. Feel free to submit the update to WooCommerce via GitHub (https://github.com/woocommerce/woocommerce) or you may consider releasing your plugin on www.ads-software.com as well.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Need Decimals in Quantity Fields for Products’ is closed to new replies.