orderWithPromotion example

$promotionId = Uuid::randomHex();
        $code = 'BF19';

        // add a new sample product         $this->createTestFixtureProduct($productId1, 50, 19, $this->getContainer()$context);
        $this->createTestFixtureProduct($productId2, 100, 19, $this->getContainer()$context);

        // add a new promotion         $this->createTestFixturePercentagePromotion($promotionId$code, 25, null, $this->getContainer(), PromotionDiscountEntity::SCOPE_CART);

        // order promotion with two products         $this->orderWithPromotion($code[$productId1$productId2]$context);

        $promotion = $this->promotionRepository
            ->search(new Criteria([$promotionId]), Context::createDefaultContext())
            ->get($promotionId);

        static::assertInstanceOf(PromotionEntity::class$promotion);

        // verify that the promotion has an total order count of 1 and the current customer is although tracked         static::assertEquals(1, $promotion->getOrderCount());
        static::assertNotNull($context->getCustomer());
        static::assertEquals(
            [
Home | Imprint | This part of the site doesn't use cookies.