EventListener/ProductDoctrineEventSubscriber.php
protected function refreshProductVariantSellPrice(VariantInterface $variant)
    {
        $product               = $variant->getProduct();
        $sellPrice             = $product->getSellPrice();
        $grossAmount           = $this->calculateAttributePrice($variant, $sellPrice->getGrossAmount());
        $discountedGrossAmount = $this->calculateAttributePrice($variant, $sellPrice->getDiscountedGrossAmount());
        $taxRate               = $product->getSellPriceTax()->getValue();
        $netAmount             = TaxHelper::calculateNetPrice($grossAmount, $taxRate);
        $discountedNetAmount   = TaxHelper::calculateNetPrice($discountedGrossAmount, $taxRate);
        
        $productAttributeSellPrice = $variant->getSellPrice();
        $productAttributeSellPrice->setTaxRate($taxRate);
        $productAttributeSellPrice->setTaxAmount($grossAmount - $netAmount);
        $productAttributeSellPrice->setGrossAmount($grossAmount);
        $productAttributeSellPrice->setNetAmount($netAmount);
        $productAttributeSellPrice->setDiscountedGrossAmount($discountedGrossAmount);
        $productAttributeSellPrice->setDiscountedTaxAmount($discountedGrossAmount - $discountedNetAmount);
        $productAttributeSellPrice->setDiscountedNetAmount($discountedNetAmount);
        $productAttributeSellPrice->setValidFrom($sellPrice->getValidFrom());
        $productAttributeSellPrice->setValidTo($sellPrice->getValidTo());
        $productAttributeSellPrice->setCurrency($sellPrice->getCurrency());
    }
protected function refreshProductVariantSellPrice(VariantInterface $variant)
    {
        $product               = $variant->getProduct();
        $sellPrice             = $product->getSellPrice();
        $grossAmount           = $this->calculateAttributePrice($variant, $sellPrice->getGrossAmount());
        $discountedGrossAmount = $this->calculateAttributePrice($variant, $sellPrice->getDiscountedGrossAmount());
        $taxRate               = $product->getSellPriceTax()->getValue();
        $netAmount             = TaxHelper::calculateNetPrice($grossAmount, $taxRate);
        $discountedNetAmount   = TaxHelper::calculateNetPrice($discountedGrossAmount, $taxRate);
        
        $productAttributeSellPrice = $variant->getSellPrice();
        $productAttributeSellPrice->setTaxRate($taxRate);
        $productAttributeSellPrice->setTaxAmount($grossAmount - $netAmount);
        $productAttributeSellPrice->setGrossAmount($grossAmount);
        $productAttributeSellPrice->setNetAmount($netAmount);
        $productAttributeSellPrice->setDiscountedGrossAmount($discountedGrossAmount);
        $productAttributeSellPrice->setDiscountedTaxAmount($discountedGrossAmount - $discountedNetAmount);
        $productAttributeSellPrice->setDiscountedNetAmount($discountedNetAmount);
        $productAttributeSellPrice->setValidFrom($sellPrice->getValidFrom());
        $productAttributeSellPrice->setValidTo($sellPrice->getValidTo());
        $productAttributeSellPrice->setCurrency($sellPrice->getCurrency());
    }
Recalculates sell prices for single product attribute

@param VariantInterface $variant