Recent Topics

OrderItemRepository.php / product_ordered_inventories on configurable products.

  • Hi Bagisto Team !
    in packages/Webkul/Sales/src/Repositories/OrderItemRepository.php
    at line 127
    if (isset($item->qty_ordered)

    shouldn't it be:

    if (isset($item->qty_ordered) && ($item->qty_ordered>0)) instead ?

    Because for configurable products, the qty ends up as zero in product_ordered_inventories and as such it will never prevent anyone from adding to the cart even though the reserve has surpassed the inventory qty.
    Try checking out a configurable product using both versions of the if statement.
    The reserve works for single products but not for configurable ones unless I set this additional condition.

    Please feel free to correct me if I am wrong ?
    Thanks in advance for your time,

  • Hi @nessuno,

    If this causing exception, then you can raise issue here with exception screenshot and steps.

  • @devansh-webkul Thanks ! It is not causing an exception but unless this is set the inventory of configurable products will not work properly. We don't need a resolution as we have resolved as per the screenshot but we thought it would be a good idea to share it.
    ps: configurable products need to reach the bloc of which takes the quantity from the parent and this does just that (otherwise the quantity of configurable products will always be zero within the original logic which nullifies the ordered inventories for configurable products).

Log in to reply