Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
product_with_second_website.php
Go to the documentation of this file.
1 <?php
6 require dirname(dirname(__DIR__)) . '/Store/_files/website.php';
7 require 'create_products.php';
8 
11  ->get(Magento\Catalog\Api\ProductAttributeRepositoryInterface::class);
13  ->setScope(Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_WEBSITE);
15 
16 $productModel->setWebsiteIds(array_merge($productModel->getWebsiteIds(), [(int)$website->getId()]));
17 $productModel->setTierPrice(
18  [
19  [
20  'website_id' => $website->getId(),
22  'price_qty' => 3,
23  'price' => 5
24  ]
25  ]
26 );
27 $productModel->save();
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$productModel