Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LoadIsInStockPlugin.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
22  private $getLegacyStockItem;
23 
27  public function __construct(GetLegacyStockItem $getLegacyStockItem)
28  {
29  $this->getLegacyStockItem = $getLegacyStockItem;
30  }
31 
40  public function afterExecute(
43  string $sku,
44  int $stockId
46  $legacyStockItem = $this->getLegacyStockItem->execute($sku);
47  $extensionAttributes = $result->getExtensionAttributes();
48  $extensionAttributes->setIsInStock((bool)(int)$legacyStockItem->getIsInStock());
49  $result->setExtensionAttributes($extensionAttributes);
50 
51  return $result;
52  }
53 }
$extensionAttributes
Definition: payment.php:22
afterExecute(GetStockItemConfigurationInterface $subject, StockItemConfigurationInterface $result, string $sku, int $stockId)