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;
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.
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
New contributor
add a comment |
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.
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
New contributor
add a comment |
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.
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
New contributor
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.
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
product magento2.3 stock quantity msi
New contributor
New contributor
edited 4 mins ago
Trimes
New contributor
asked Apr 24 at 12:56
TrimesTrimes
1
1
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs
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
add a comment |
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]);
New contributor
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs
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
add a comment |
Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs
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
add a comment |
Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs
Use this page for the corresponding match for new Inventory API - https://github.com/magento-engcom/msi/wiki/Magento-MSI-APIs
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
add a comment |
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
add a comment |
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]);
New contributor
add a comment |
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]);
New contributor
add a comment |
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]);
New contributor
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]);
New contributor
New contributor
answered 7 mins ago
TrimesTrimes
1
1
New contributor
New contributor
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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