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

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

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

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form