How to set qty to product on MSI Magento 2.3QTY at 0 doesn't change product to Out of StockMagento 2.3 add Product scriptExisting Products not saving after upgrading to Magento 2.3Assign Inventory source while programmatically creating productManage Stock only option available is YesMagento 2.3 - Salable Quantity turning offShowing Salable QTY in frontend Magento 2.3Magento 2 How to decrease product qty from source same as “Product Salable qty” after orderd placed to make product out of stock?Magento MSI; add custom attribute to Sources in M2While saving product throws “Unable to save Stock Item” exception in magento 2.2.6

Why is it that the natural deduction method can't test for invalidity?

Meaning of Bloch representation

What are the potential pitfalls when using metals as a currency?

Mac Pro install disk keeps ejecting itself

Any examples of headwear for races with animal ears?

Does a semiconductor follow Ohm's law?

Is there any limitation with Arduino Nano serial communication distance?

What does the "ep" capability mean?

Shrinkwrap tetris shapes without scaling or diagonal shapes

Why other Westeros houses don't use wildfire?

How to make a pipeline wait for end-of-file or stop after an error?

How can the Zone of Truth spell be defeated without the caster knowing?

What makes accurate emulation of old systems a difficult task?

What do the phrase "Reeyan's seacrest" and the word "fraggle" mean in a sketch?

Examples of non trivial equivalence relations , I mean equivalence relations without the expression " same ... as" in their definition?

Why do games have consumables?

What is the strongest case that can be made in favour of the UK regaining some control over fishing policy after Brexit?

If a warlock with the Repelling Blast invocation casts Eldritch Blast and hits, must the targets always be pushed back?

Is the 5 MB static resource size limit 5,242,880 bytes or 5,000,000 bytes?

How much cash can I safely carry into the USA and avoid civil forfeiture?

a sore throat vs a strep throat vs strep throat

Are Boeing 737-800’s grounded?

With a Canadian student visa, can I spend a night at Vancouver before continuing to Toronto?

Is there a way to get a compiler for the original B programming language?



How to set qty to product on MSI Magento 2.3


QTY at 0 doesn't change product to Out of StockMagento 2.3 add Product scriptExisting Products not saving after upgrading to Magento 2.3Assign Inventory source while programmatically creating productManage Stock only option available is YesMagento 2.3 - Salable Quantity turning offShowing Salable QTY in frontend Magento 2.3Magento 2 How to decrease product qty from source same as “Product Salable qty” after orderd placed to make product out of stock?Magento MSI; add custom attribute to Sources in M2While saving product throws “Unable to save Stock Item” exception in magento 2.2.6






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















In my custom module, I'm using StockRegistryInterface to set qty and save my product. But on Magento 2.3 I started facing the issue of having 0 salable qty right after saving the product.



Default stock 0



After digging a bit, I saw that StockRegistryInterface is deprecated and it was replaced with Multi Source Inventory. How should I save the qty of my product now?



Here is the piece of code where I do it with StockRegistryInterface:



 /* @var ProductInterface $product */
$stockItem = $this->stock->getStockItemBySku($product->getSku());
$stockItem->setQty($this->estoque_disponivel);
$stockItem->setIsInStock(true);
$this->stock->updateStockItemBySku($product->getSku(), $stockItem);









share|improve this question









New contributor




Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    0















    In my custom module, I'm using StockRegistryInterface to set qty and save my product. But on Magento 2.3 I started facing the issue of having 0 salable qty right after saving the product.



    Default stock 0



    After digging a bit, I saw that StockRegistryInterface is deprecated and it was replaced with Multi Source Inventory. How should I save the qty of my product now?



    Here is the piece of code where I do it with StockRegistryInterface:



     /* @var ProductInterface $product */
    $stockItem = $this->stock->getStockItemBySku($product->getSku());
    $stockItem->setQty($this->estoque_disponivel);
    $stockItem->setIsInStock(true);
    $this->stock->updateStockItemBySku($product->getSku(), $stockItem);









    share|improve this question









    New contributor




    Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      In my custom module, I'm using StockRegistryInterface to set qty and save my product. But on Magento 2.3 I started facing the issue of having 0 salable qty right after saving the product.



      Default stock 0



      After digging a bit, I saw that StockRegistryInterface is deprecated and it was replaced with Multi Source Inventory. How should I save the qty of my product now?



      Here is the piece of code where I do it with StockRegistryInterface:



       /* @var ProductInterface $product */
      $stockItem = $this->stock->getStockItemBySku($product->getSku());
      $stockItem->setQty($this->estoque_disponivel);
      $stockItem->setIsInStock(true);
      $this->stock->updateStockItemBySku($product->getSku(), $stockItem);









      share|improve this question









      New contributor




      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      In my custom module, I'm using StockRegistryInterface to set qty and save my product. But on Magento 2.3 I started facing the issue of having 0 salable qty right after saving the product.



      Default stock 0



      After digging a bit, I saw that StockRegistryInterface is deprecated and it was replaced with Multi Source Inventory. How should I save the qty of my product now?



      Here is the piece of code where I do it with StockRegistryInterface:



       /* @var ProductInterface $product */
      $stockItem = $this->stock->getStockItemBySku($product->getSku());
      $stockItem->setQty($this->estoque_disponivel);
      $stockItem->setIsInStock(true);
      $this->stock->updateStockItemBySku($product->getSku(), $stockItem);






      product magento2.3 stock quantity msi






      share|improve this question









      New contributor




      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 4 mins ago







      Trimes













      New contributor




      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 24 at 12:56









      TrimesTrimes

      1




      1




      New contributor




      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          2 Answers
          2






          active

          oldest

          votes


















          0














          Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs






          share|improve this answer























          • Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

            – Trimes
            5 mins ago


















          0














          I found how to set qty to the product on the 'MSI way'.



          PS: I'm using the default source.



          The constructor:



          private $sourceItemsSave;
          private $sourceItemInterface;

          public function __construct(
          SourceItemInterface $sourceItemInterface,
          SourceItemsSaveInterface $sourceItemsSave,
          )

          $this->sourceItemsSave = $sourceItemsSave;
          $this->sourceItemInterface = $sourceItemInterface;



          Saving the qty:



          public function setQtyToProduct($product, $qty)

          /* @var ProductInterface $product */

          $this->sourceItemInterface->setSku($product->getSku());
          $this->sourceItemInterface->setQuantity($qty);
          $this->sourceItemInterface->setStatus(1);
          $this->sourceItemInterface->setSourceCode('default');
          $this->sourceItemsSave->execute([$this->sourceItemInterface]);





          share








          New contributor




          Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.




















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            Trimes is a new contributor. Be nice, and check out our Code of Conduct.









            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272296%2fhow-to-set-qty-to-product-on-msi-magento-2-3%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs






            share|improve this answer























            • Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

              – Trimes
              5 mins ago















            0














            Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs






            share|improve this answer























            • Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

              – Trimes
              5 mins ago













            0












            0








            0







            Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs






            share|improve this answer













            Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 2 days ago









            Igor MinyayloIgor Minyaylo

            73637




            73637












            • Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

              – Trimes
              5 mins ago

















            • Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

              – Trimes
              5 mins ago
















            Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

            – Trimes
            5 mins ago





            Thanks a lot, I wish I had seen it before. I posted an answer showing how I did to save it in the default source.

            – Trimes
            5 mins ago













            0














            I found how to set qty to the product on the 'MSI way'.



            PS: I'm using the default source.



            The constructor:



            private $sourceItemsSave;
            private $sourceItemInterface;

            public function __construct(
            SourceItemInterface $sourceItemInterface,
            SourceItemsSaveInterface $sourceItemsSave,
            )

            $this->sourceItemsSave = $sourceItemsSave;
            $this->sourceItemInterface = $sourceItemInterface;



            Saving the qty:



            public function setQtyToProduct($product, $qty)

            /* @var ProductInterface $product */

            $this->sourceItemInterface->setSku($product->getSku());
            $this->sourceItemInterface->setQuantity($qty);
            $this->sourceItemInterface->setStatus(1);
            $this->sourceItemInterface->setSourceCode('default');
            $this->sourceItemsSave->execute([$this->sourceItemInterface]);





            share








            New contributor




            Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.
























              0














              I found how to set qty to the product on the 'MSI way'.



              PS: I'm using the default source.



              The constructor:



              private $sourceItemsSave;
              private $sourceItemInterface;

              public function __construct(
              SourceItemInterface $sourceItemInterface,
              SourceItemsSaveInterface $sourceItemsSave,
              )

              $this->sourceItemsSave = $sourceItemsSave;
              $this->sourceItemInterface = $sourceItemInterface;



              Saving the qty:



              public function setQtyToProduct($product, $qty)

              /* @var ProductInterface $product */

              $this->sourceItemInterface->setSku($product->getSku());
              $this->sourceItemInterface->setQuantity($qty);
              $this->sourceItemInterface->setStatus(1);
              $this->sourceItemInterface->setSourceCode('default');
              $this->sourceItemsSave->execute([$this->sourceItemInterface]);





              share








              New contributor




              Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.






















                0












                0








                0







                I found how to set qty to the product on the 'MSI way'.



                PS: I'm using the default source.



                The constructor:



                private $sourceItemsSave;
                private $sourceItemInterface;

                public function __construct(
                SourceItemInterface $sourceItemInterface,
                SourceItemsSaveInterface $sourceItemsSave,
                )

                $this->sourceItemsSave = $sourceItemsSave;
                $this->sourceItemInterface = $sourceItemInterface;



                Saving the qty:



                public function setQtyToProduct($product, $qty)

                /* @var ProductInterface $product */

                $this->sourceItemInterface->setSku($product->getSku());
                $this->sourceItemInterface->setQuantity($qty);
                $this->sourceItemInterface->setStatus(1);
                $this->sourceItemInterface->setSourceCode('default');
                $this->sourceItemsSave->execute([$this->sourceItemInterface]);





                share








                New contributor




                Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                I found how to set qty to the product on the 'MSI way'.



                PS: I'm using the default source.



                The constructor:



                private $sourceItemsSave;
                private $sourceItemInterface;

                public function __construct(
                SourceItemInterface $sourceItemInterface,
                SourceItemsSaveInterface $sourceItemsSave,
                )

                $this->sourceItemsSave = $sourceItemsSave;
                $this->sourceItemInterface = $sourceItemInterface;



                Saving the qty:



                public function setQtyToProduct($product, $qty)

                /* @var ProductInterface $product */

                $this->sourceItemInterface->setSku($product->getSku());
                $this->sourceItemInterface->setQuantity($qty);
                $this->sourceItemInterface->setStatus(1);
                $this->sourceItemInterface->setSourceCode('default');
                $this->sourceItemsSave->execute([$this->sourceItemInterface]);






                share








                New contributor




                Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share


                share






                New contributor




                Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 7 mins ago









                TrimesTrimes

                1




                1




                New contributor




                Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                Trimes is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




















                    Trimes is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    Trimes is a new contributor. Be nice, and check out our Code of Conduct.












                    Trimes is a new contributor. Be nice, and check out our Code of Conduct.











                    Trimes is a new contributor. Be nice, and check out our Code of Conduct.














                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272296%2fhow-to-set-qty-to-product-on-msi-magento-2-3%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?