• Resolved guntarsskapsts

    (@guntarsskapsts)


    Hi!
    I’m currently working on payment gateway.
    I have disabled stock management in WooCommerce inventory settings.
    WooCommerce version is 3.5.1.

    If payment has not been successful, order status is set to failed and user is redirected to order received page.

    So when I click on pay button, I get “Sorry, we do not have enough “x” in stock to fulfill your order (0 available)” message.

    When debugging, I noticed there is no check if stock management is enabled.
    wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:117

    Any help appreciated

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there,

    It sounds like you’re running into the hold stock option – the stock will be held until the order has been cancelled or moves into processing. If you don’t want that option, you can set the hold stock option to 0. It’s under WooCommerce > Settings > Products > Inventory.

    Thread Starter guntarsskapsts

    (@guntarsskapsts)

    Thank you for reply.

    The thing is, I have entirely disabled stock management, in which case hold stock field disappears. It would probably work if I enabled stock management, set 0 in in hold stock and disabled stock management again. It just seems to be bug in WooCommerce as there should probably be a check, if stock management is enabled before checking stock in wp-content/plugins/woocommerce/includes/shortcodes/class-wc-shortcode-checkout.php:117

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    It would probably work if I enabled stock management, set 0 in in hold stock and disabled stock management again. It just seems to be bug in WooCommerce as there should probably be a check

    Indeed – it’s one of WooCommerce’s little gotchas. If you already know how to fix this, it would be great if you could do a pull request for WooCommerce given that it’s open source:
    https://github.com/woocommerce/woocommerce

    Does that clear things up for you?

    Thread Starter guntarsskapsts

    (@guntarsskapsts)

    It seems to be already done. Will it be included in next release?
    https://github.com/woocommerce/woocommerce/commit/aabae5d21fa67fc314398f8d0ab47e3cdbf033d0

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Hey there,

    It has indeed been committed to the master, so I’d expect to see it in WC 3.5.2. I’m not sure when that will be released, though.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Customer payment page checking stock even if stock management is disabled’ is closed to new replies.