Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Inventory deducted on order

    Knowledge Base
    4
    6
    494
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      otheriz last edited by otheriz

      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..

      1 Reply Last reply Reply Quote 1
      • devansh-webkul
        devansh-webkul last edited by

        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.

        N 1 Reply Last reply Reply Quote 1
        • O
          otheriz last edited by otheriz

          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..

          1 Reply Last reply Reply Quote 1
          • devansh-webkul
            devansh-webkul last edited by

            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.

            1 Reply Last reply Reply Quote 1
            • N
              nessuno @devansh-webkul last edited by nessuno

              @devansh-webkul and @otheriz Thank you this quite useful as I need to custom to the same thing ( Inventory subtracted at Order creation ). Thanks !!!!!!!

              H 1 Reply Last reply Reply Quote 0
              • H
                harpreet2301 @nessuno last edited by

                @nessuno Hi can you share the solution you used

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post