getPriceValue example

$product->assign(['calculatedCheapestPrice' => $calculated]);
    }

    private function buildDefinition(
        Entity $product,
        PriceCollection $prices,
        SalesChannelContext $context,
        UnitCollection $units,
        ReferencePriceDto $reference,
        int $quantity = 1
    ): QuantityPriceDefinition {
        $price = $this->getPriceValue($prices$context);

        $taxId = $product->get('taxId');
        $definition = new QuantityPriceDefinition($price$context->buildTaxRules($taxId)$quantity);
        $definition->setReferencePriceDefinition(
            $this->buildReferencePriceDefinition($reference$units)
        );
        $definition->setListPrice(
            $this->getListPrice($prices$context)
        );
        $definition->setRegulationPrice(
            $this->getRegulationPrice($prices$context)
        );
break;
            }
        }

        if (empty($prices)) {
            return null;
        }

        $cheapest = array_shift($prices);

        $reference = $this->getPriceValue($cheapest$context);

        $hasRange = (bool) $cheapest['is_ranged'];

        // NEXT-21735 - This is covered randomly         // @codeCoverageIgnoreStart         foreach ($prices as $price) {
            $current = $this->getPriceValue($price$context);

            if ($current === null) {
                continue;
            }

            
Home | Imprint | This part of the site doesn't use cookies.