Timeline for Programmatically create a simple product in magento 2
Current License: CC BY-SA 4.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 18, 2020 at 12:55 | comment | added | Haijerome | just a little addition, instead of adding all the code inside the callback function, one can also do it this way, $this->appState->emulateAreaCode( 'adminhtml', [$this, "saveProduct"], [$_product] ); where saveProduct is a class method public function saveProduct(ProductInterface $_product){$_savedProduct = $this->productRepository->save($_product);} | |
Jun 27, 2018 at 17:52 | history | edited | Navarr | CC BY-SA 4.0 |
Added information on how to set product stock, and moved to emulating the area code instead of setting it (more proper)
|
Jun 6, 2017 at 16:58 | history | answered | Navarr | CC BY-SA 3.0 |