public function thereIsQuantityOfProducts($quantity, ProductInterface $product) { /** @var ProductVariantInterface $productVariant */ $productVariant = $this->defaultVariantResolver->getVariant($product); $productVariant->setOnHand($quantity); $this->objectManager->flush(); }