11 use Magento\Catalog\Api\Data\ProductCustomOptionInterfaceFactory;
20 Bootstrap::getInstance()->reinitialize();
31 $product->setTypeId(Type::TYPE_SIMPLE)
33 ->setAttributeSetId(4)
35 ->setName(
'Simple Product')
39 ->setShortDescription(
"Short description")
45 'cust_group' => \
Magento\Customer\Model\Group::CUST_GROUP_ALL,
51 'cust_group' => \
Magento\Customer\Model\Group::CUST_GROUP_ALL,
57 'cust_group' => \
Magento\Customer\Model\Group::NOT_LOGGED_IN_ID,
63 ->setDescription(
'Description with <b>html tag</b>')
64 ->setMetaTitle(
'meta title')
65 ->setMetaKeyword(
'meta keyword')
66 ->setMetaDescription(
'meta description')
67 ->setVisibility(Visibility::VISIBILITY_BOTH)
68 ->setStatus(Status::STATUS_ENABLED)
71 'use_config_manage_stock' => 1,
73 'is_qty_decimal' => 0,
76 )->setCanSaveCustomOptions(
true)
78 ->setCustomAttribute(
'test_configurable', 42);
82 'previous_group' =>
'text',
83 'title' =>
'Test Field',
88 'price_type' =>
'fixed',
90 'max_characters' => 100,
93 'previous_group' =>
'date',
94 'title' =>
'Test Date and Time',
95 'type' =>
'date_time',
99 'price_type' =>
'fixed',
103 'previous_group' =>
'select',
104 'title' =>
'Test Select',
105 'type' =>
'drop_down',
110 'option_type_id' =>
null,
111 'title' =>
'Option 1',
113 'price_type' =>
'fixed',
114 'sku' =>
'3-1-select',
117 'option_type_id' =>
null,
118 'title' =>
'Option 2',
120 'price_type' =>
'fixed',
121 'sku' =>
'3-2-select',
126 'previous_group' =>
'select',
127 'title' =>
'Test Radio',
133 'option_type_id' =>
null,
134 'title' =>
'Option 1',
136 'price_type' =>
'fixed',
137 'sku' =>
'4-1-radio',
140 'option_type_id' =>
null,
141 'title' =>
'Option 2',
143 'price_type' =>
'fixed',
144 'sku' =>
'4-2-radio',
$productRepositoryFactory