moduleDataSetup = $moduleDataSetup; $this->categorySetupFactory = $categorySetupFactory; } /** * {@inheritdoc} */ public function apply() { /** @var \Magento\Catalog\Setup\CategorySetup $categorySetup */ $categorySetup = $this->categorySetupFactory->create(); $this->moduleDataSetup->getConnection()->startSetup(); $entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); $this->changePriceAttributeDefaultScope($categorySetup, $entityTypeId); $this->moduleDataSetup->getConnection()->endSetup(); } /** * {@inheritdoc} */ public static function getDependencies() { return [ InitializeMsrpAttributes::class ]; } /** * {@inheritdoc} */ public static function getVersion() { return '2.1.3'; } /** * {@inheritdoc} */ public function getAliases() { return []; } /** * Change default scope for price attribute. * * @param \Magento\Catalog\Setup\CategorySetup $categorySetup * @param int $entityTypeId */ private function changePriceAttributeDefaultScope($categorySetup, $entityTypeId) { $attribute = $categorySetup->getAttribute($entityTypeId, 'msrp'); $categorySetup->updateAttribute( $entityTypeId, $attribute['attribute_id'], 'is_global', \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL ); } }