Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Bundle
_files
empty_bundle_product.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
9
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
11
$productRepository
=
$objectManager
->create(\
Magento
\Catalog\Api\ProductRepositoryInterface::class);
13
$product
=
$objectManager
->create(\
Magento
\Catalog\Model\Product::class);
14
$product
->setTypeId(
'bundle'
)
15
->setAttributeSetId(4)
16
->setWebsiteIds([1])
17
->setName(
'Bundle Product'
)
18
->setSku(
'bundle-product'
)
19
->setVisibility(\
Magento
\Catalog\Model\Product\Visibility::VISIBILITY_BOTH)
20
->setStatus(\
Magento
\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED)
21
->setStockData([
'use_config_manage_stock'
=> 1,
'qty'
=> 100,
'is_qty_decimal'
=> 0,
'is_in_stock'
=> 1])
22
->setPriceView(0)
23
->setPriceType(0)
24
->setShipmentType(1)
25
->setWeightType(0)
26
->setDescription(
'description'
)
27
->setPrice(99);
28
29
$productRepository
->save(
$product
);
$productRepository
$productRepository
Definition:
empty_bundle_product.php:11
$objectManager
$objectManager
Definition:
empty_bundle_product.php:9
$product
$product
Definition:
empty_bundle_product.php:13
Magento
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125