Recent Topics

Inventory deducted on order



  • Dear Bagisto,

    Like the title says,
    is there any setting to make inventory deducted when user order ? not on 'shipping'. ?
    and when it applies the 'shipping' function will not do anything to the inventory..(Except you edit or remove the items at shipping)
    and the inventory QTY will return if the user cancels the order..

    If not can you tell me how to do that(which file need to edit or the algorithm)

    Thank You..



  • Hi @otheriz,

    There is a method named as 'saveOrder()' in file 'packages/Webkul/Shop/src/Http/Controllers/OnepageController.php'.

    This is the method where order is placed. If you want to go deeper than you will see that in this method we have used order repository.

    $order = $this->orderRepository->create(Cart::prepareDataForOrder());
    

    This line create your order, inside order repository's create method (Path: 'packages/Webkul/Sales/src/Repositories/OrderRepository.php'), you will see 'manageInventory' call.

    $this->orderItemRepository->manageInventory($orderItem);
    

    These are the methods which will help you.



  • hi @devansh-webkul , thank you for your information

    Currently, i try another approach..why i raise this query because we have another system for warehouse & logistic which is the item QTY is deducted on order..

    I want to sync the inventory from the warehouse system..but since it has different 'deducting' approach it's gonna be problem
    Warehouse -> QTY deducted on Order
    Bagisto -> QTY deducted on Shipped

    Warehouse -> QTY = 10(already deducted) & Order = 10
    Bagisto -> QTY =20(not deducted until shipping) & Order = 10

    If i sync the current bagisto inventory with warehouse qty will be a difference and become a problem

    But there's some 'solution' 🙂 ...i see the bagisto 'add to cart' have some 'methods' that cannot allow the customer to order if the Inventory is less than currently ordered(not shipped)...can you tell me the 'method' location ? maybe something like Bagisto->checkOrder($itemID) or something...

    so i can use it to sync
    Warehouse QTY = 10 + Bagisto Order(not Shipped) = 10..
    Then i sync Bagisto QTY = 20..

    If my question and explanation unclear please tell me..



  • Hi @otheriz,

    If you check this folder 'packages/Webkul/Product/src/Type', you will see that there are types of product class which is inherited by an abstract class.

    In class method you will find 'haveSufficientQuantity()'. This is the method which check sufficient quantity.


Log in to reply