getFeatures example



    private function buildFeatures(CartDataCollection $data, LineItem $lineItem, SalesChannelProductEntity $product): array
    {
        $features = [];
        $featureSet = $product->getFeatureSet();

        if ($featureSet === null) {
            return $features;
        }

        $sorted = $featureSet->getFeatures();

        if (empty($sorted)) {
            return $features;
        }

        usort($sortedstatic fn (array $a, array $b) => $a['position'] <=> $b['position']);

        foreach ($sorted as $feature) {
            if ($feature['type'] === ProductFeatureSetDefinition::TYPE_PRODUCT_ATTRIBUTE) {
                $features[] = $this->getAttribute($feature['name']$product);

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