forked from magepow/magento-2-programmatically
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsalableQuantity.php
More file actions
24 lines (19 loc) · 759 Bytes
/
salableQuantity.php
File metadata and controls
24 lines (19 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
require dirname(__FILE__) . '/app/bootstrap.php';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
class Outslide extends \Magento\Framework\App\Http
implements \Magento\Framework\AppInterface {
public function launch()
{
$appState = $this->_objectManager->get('Magento\Framework\App\State');
$appState->setAreaCode('frontend');
$stockState = $this->_objectManager->get('\Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku');
$productSku = 'WT09';
$qty = $stockState->execute($productSku);
echo 'Qty: ' . $qty[0]['qty'];
return $this->_response;
}
}
/** @var \Magento\Framework\App\Http $app */
$app = $bootstrap->createApplication('Outslide');
$bootstrap->run($app);