How to set qty to product on MSI Magento 2.3QTY at 0 doesn't change product to Out of StockMagento 2.3 add...
Why does processed meat contain preservatives, while canned fish needs not?
Why was the Spitfire's elliptical wing almost uncopied by other aircraft of World War 2?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
a sore throat vs a strep throat vs strep throat
Why don't other Westeros houses use wildfire?
Does this extra sentence in the description of the warlock's Eyes of the Rune Keeper eldritch invocation appear in any official reference?
How to verbalise code in Mathematica?
Critique of timeline aesthetic
Don’t seats that recline flat defeat the purpose of having seatbelts?
Sci fi novel series with instant travel between planets through gates. A river runs through the gates
With a Canadian student visa, can I spend a night at Vancouver before continuing to Toronto?
Using a Lyapunov function to classify stability and sketching a phase portrait
Does the sign matter for proportionality?
What language was spoken in East Asia before Proto-Turkic?
Unexpected email from Yorkshire Bank
How to get a plain text file version of a CP/M .BAS (M-BASIC) program?
What does the "ep" capability mean?
How to solve constants out of the internal energy equation?
What is the difference between `command a[bc]d` and `command `a{b,c}d`
Is there really no use for MD5 anymore?
Are Boeing 737-800’s grounded?
Pulling the rope with one hand is as heavy as with two hands?
Rivers without rain
What happened to Captain America in Endgame?
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 24 mins ago
Trimes
New contributor
asked Apr 24 at 12:56
TrimesTrimes
11
11
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
26 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
26 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
26 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
26 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
26 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
26 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
26 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 27 mins ago
TrimesTrimes
11
11
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