createSetGroupFixture example

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

        // add 2 test products         $this->createTestFixtureProduct($productId1, 119, 19, $this->getContainer()$this->context);
        $this->createTestFixtureProduct($productId2, 107, 7, $this->getContainer()$this->context);

        // add a new promotion         $this->createTestFixtureFixedDiscountPromotion($promotionId, 200, PromotionDiscountEntity::SCOPE_SET, $code$this->getContainer()$this->context);
        $this->createSetGroupFixture('COUNT', 5, 'PRICE_ASC', $promotionId$this->getContainer());

        $cart = $this->cartService->getCart($this->context->getToken()$this->context);

        // create first product and add to cart         $cart = $this->addProduct($productId1, 5, $cart$this->cartService, $this->context);
        $cart = $this->addProduct($productId2, 3, $cart$this->cartService, $this->context);

        // create promotion and add to cart         $cart = $this->addPromotionCode($code$cart$this->cartService, $this->context);

        /** @var CalculatedPrice $discountPrice */
        
Home | Imprint | This part of the site doesn't use cookies.