Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
fixed_bundle_product.php
Go to the documentation of this file.
1 <?php
7 require __DIR__ . '/../../../../Magento/Bundle/_files/multiple_products.php';
8 
10 $productRepository = $objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
11 
13 $product = $objectManager->create(\Magento\Catalog\Model\Product::class);
14 $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE)
15  ->setId(42)
16  ->setAttributeSetId(4)
17  ->setWebsiteIds([1])
18  ->setName('Bundle Product')
19  ->setSku('bundle_product')
20  ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
21  ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
22  ->setStockData(['use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1])
23  ->setPriceView(0)
24  ->setPriceType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED)
25  ->setPrice(110.0)
26  ->setShipmentType(0);
27 
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$productRepository