addSingleLineItem example

$payload = $this->contextPersister->load($salesChannelContext->getToken()$salesChannelContext->getSalesChannel()->getId());
        $payload[SalesChannelContextService::PERMISSIONS][ProductCartProcessor::ALLOW_PRODUCT_PRICE_OVERWRITES] = true;
        $this->contextPersister->save($salesChannelContext->getToken()$payload$salesChannelContext->getSalesChannel()->getId());

        $browser = $this->createCart(TestDefaults::SALES_CHANNEL);

        $firstProductId = $this->ids->get('p1');
        $secondProductId = $this->ids->get('p2');
        $this->createTestFixtureProduct($firstProductId, 119, 19, $this->getContainer()$salesChannelContext);
        $this->createTestFixtureProduct($secondProductId, 200, 10, $this->getContainer()$salesChannelContext);

        $this->addSingleLineItem($browser, TestDefaults::SALES_CHANNEL, [
            'id' => $firstProductId,
            'label' => $firstProductId,
            'referencedId' => $firstProductId,
            'quantity' => 1,
            'type' => LineItem::PRODUCT_LINE_ITEM_TYPE,
            'priceDefinition' => [
                'price' => 100,
                'taxRules' => [[
                    'taxRate' => 19,
                    'percentage' => 100,
                ]],
                
Home | Imprint | This part of the site doesn't use cookies.