/** * @param EntityInterface $object */ private function restoreItemsStock(EntityInterface $object) { foreach ($object->getItems() as $item) { /** @var \Jigoshop\Entity\Order\Item $item */ $product = $item->getProduct(); if ($product instanceof Variable) { $product = $product->getVariation($item->getMeta('variation_id')->getValue())->getProduct(); } if ($product->getStock()->getManage()) { $this->wp->doAction('jigoshop\\product\\restore', $product, $item->getQuantity(), $item); } } }