Timeline for Update Product QTY right before place order from external remote API
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 19, 2019 at 4:58 | comment | added | siddhrock | Please upvote question too | |
Nov 19, 2019 at 4:57 | vote | accept | siddhrock | ||
Nov 15, 2019 at 11:01 | comment | added | Yash Shah | Please upvote and accept if that worked for you !!! | |
Nov 15, 2019 at 10:42 | comment | added | siddhrock | thanks for your answer.. | |
Nov 14, 2019 at 5:53 | comment | added | Yash Shah | @siddhrock, check my updated answer. This must work for you !!! | |
Nov 14, 2019 at 5:53 | history | edited | Yash Shah | CC BY-SA 4.0 |
added 465 characters in body
|
Nov 13, 2019 at 14:21 | comment | added | siddhrock |
<?php foreach ($items as $item) { $sku = $curldata['sku'];//api sku $prodcollectionsku = $this->_productRepository->get($sku); //using \Magento\Catalog\Model\ProductRepository $prodcollectionsku->setStockData( [ 'qty' => $curldata['quantity'], 'manage_stock' => 1 ] ); $prodcollectionsku->setQuantityAndStockStatus(['qty' => $curldata['quantity'], 'manage_stock' => 1]); try { $prodcollectionsku->save(); } catch (Exception $e) { echo "Error In Product Save" . $e->getMessage(); } }
|
|
Nov 13, 2019 at 13:46 | comment | added | Yash Shah | @siddhrock, can you please paste the code you did. | |
Nov 13, 2019 at 13:42 | comment | added | siddhrock | We already tried that way to update qty, but it's not updating qty while clicking on "Place Order" .. we got qty from remote API and sales quantity as well.. but it's not updating it.. | |
Nov 13, 2019 at 13:39 | comment | added | Yash Shah | @siddhrock, Then you can load the product using product model/repository and update the stock qty to that as per your api, The default magento should validate then. Check with that option. | |
Nov 13, 2019 at 13:34 | comment | added | siddhrock | we want to update qty from remote API before place an order.. so cases like if existing product has 10 qty at backend and through remote API we got 0 qty .. so when customer try to place an order it should update qty to 0 and show a message . | |
Nov 13, 2019 at 13:03 | history | answered | Yash Shah | CC BY-SA 4.0 |