Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
product_without_options.php
Go to the documentation of this file.
1 <?php
9 $product->setTypeId(
10  'simple'
11 )->setId(
12  1
13 )->setAttributeSetId(
14  4
15 )->setWebsiteIds(
16  [1]
17 )->setName(
18  'Simple Product Without Custom Options'
19 )->setSku(
20  'simple'
21 )->setPrice(
22  10
23 )->setMetaTitle(
24  'meta title'
25 )->setMetaKeyword(
26  'meta keyword'
27 )->setMetaDescription(
28  'meta description'
29 )->setVisibility(
30  \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
31 )->setStatus(
32  \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
33 )->setQty(
34  100
35 )->save();