TransWikia.com

How to set different product attribute Default value for different store view?

Magento Asked on February 16, 2021

I’m using magento 2.4, i just created a new product attribute like this:

     $eavSetup->addAttribute(
        MagentoCatalogModelProduct::ENTITY,
        'brand_history',
        [
            'type' => 'text',
            'label' => 'Brand History',
            'input' => 'textarea',
            'source' => '',
            'frontend' => '',
            'required' => false,
            'backend' => '',
            'sort_order' => '74',
            'global' => ScopedAttributeInterface::SCOPE_STORE,
            'visible' => true,
            'user_defined' => true,
            'searchable' => false,
            'filterable' => false,
            'comparable' => false,
            'visible_on_front' => false,
            'unique' => false,
            'group' => 'General',
            'used_in_product_listing' => false,
            'is_used_in_grid' => true,
            'is_visible_in_grid' => false,
            'is_filterable_in_grid' => false,
            'wysiwyg_enabled' => true,
            'option' => array('values' => array("")),
            'group' => $groupName,
            'apply_to' => 'brand',
            'default' => '<p><span><strong>History:</strong></span></p>
                          <ul>
                            <li><span>Built in: 1992.</span></li> 
                            <li><span>Can survive in the cold winter night.</span></li> 
                          </ul>',
        ]
    );

currently, when I create a new product, I can see the default value. The problem is i have a different store view that has a different language, and when i changed the store view when i create the product I need to have a different default value, how can I achieve this?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP