- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Magento 2.3 stock (what interface to use)
Should i be using:
vendor/magento/module-catalog-inventory/Api/???
or
vendor/magento/module-inventory-api/api/??
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: programmatically adding configurable (parent) as in stock
Hi @mayhem1 ,
Can you add code that you have tried? Also, specify which version did you try.
If Issue Solved, Click Kudos and Accept As solutions.
Sohel Rana, 7x Magento 2, 2x Magento 1 Certified
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: programmatically adding configurable (parent) as in stock
Hello @mayhem1 ,
Might be there will be some issue on parameter, Can you please comparision with below data
"configurable_product_options":[ { "attribute__id":"192", "label":"Colour", "values":[ { "value_index":340 }, { "value_index":341 } ] }, { "attribute__id":"193", "label":"Size", "values":[ { "value_index":343 }, { "value_index":342 } ]
Also added the product links in the same request so final configurable product request looks like this:
{ "product":{ "sku":"KudosConfig", "name":"Kudos Configurable", "price":30, "status":1, "type_id":"configurable", "attribute_set_id":4, "extension_attributes":{ "stock_item":{ "is_in_stock":true }, "configurable_product_options":[ { "attribute__id":"193", "label":"Colour", "position":0, "values":[ { "value_index":340 }, { "value_index":341 } ], "product_id":299 }, { "attribute__id":"192", "label":"Size", "position":1, "values":[ { "value_index":343 }, { "value_index":342 } ], "product_id":299 } ], "configurable_product_links":[ 300, 301, 302, 303 ] } } }
--
If my answer is useful, please Accept as Solution & give Kudos
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
delete
delete
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how do you set stock qty (inventory) for configurable products in Magento 2.3?
I'm running in single store mode. Products are configured to be in WebsiteId:0, StoreId:1.
I have a product loop that creates products. I create the product, save with product repository, and then try and set it's stock values.
$objSourceItemInterfaceFactory = $objectManager->get('Magento\InventoryApi\Api\Data\SourceItemInterfaceFactory');
$objSourceItemsSaveInterface = $objectManager->get('Magento\InventoryApi\Api\SourceItemsSaveInterface'); //try and set product stock for the "default" warehouse/source. $objSourceItemInterface = $objSourceItemInterfaceFactory->create(); $objSourceItemInterface->setSku($csvdata_sSku); $objSourceItemInterface->setSourceCode('default'); //default warehouse. $objSourceItemInterface->setQuantity($csvdata_dInvAvail); $objSourceItemInterface->setStatus((($csvdata_dInvAvail > 0)?1:0)); $arrSourceItemInterfaces = array(); $arrSourceItemInterfaces[] = $objSourceItemInterface; try{ $objSourceItemsSaveInterface->execute($arrSourceItemInterfaces); }catch(Exception $e){ echo "Exception: $e<br>"; }
I think my issue is solved in the MSI 1.1.0 release.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: how do you set stock qty (inventory) for configurable products in Magento 2.3?
I have the same issue. Have you found a solution to this?