Created
July 20, 2022 03:20
-
-
Save tvthu/133d59870ac76753c01f0de02900a743 to your computer and use it in GitHub Desktop.
Test magento 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', 1); | |
ini_set('max_execution_time', 0); | |
ini_set("memory_limit", "-1"); | |
set_time_limit(0); | |
error_reporting(E_ALL); | |
require './app/bootstrap.php'; | |
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); | |
$objectManager = $bootstrap->getObjectManager(); | |
$state = $objectManager->get('Magento\Framework\App\State'); | |
$state->setAreaCode('frontend'); | |
$productRepo = $objectManager->get('\Magento\Catalog\Model\ProductRepository'); | |
$StockState = $objectManager->get('\Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku'); | |
/** | |
* @var \Magento\Catalog\Model\Product $product | |
*/ | |
$product = $productRepo->getById('58227'); | |
// $product = $productRepo->getById('58226'); | |
// echo json_encode($StockState->execute( $product->getSku()), 1); | |
echo json_encode($product->isSalable()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment