Redeem Now
Read More
Read now
Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Update Product Custom Attribute Scope in Magento 2

    Here we learn in Magento2 – How to update product custom attribute’s scope from installer file in the custom module.
    If you want to create a new custom attribute in Magento 2, you can check the wonderful blog from here

    If there is an attribute with store view scope.

    1=>First we need to create an installer file name UpgradeData.php in our custom module Setup folder
    complete path: app/code/ModuleNameSpace/YourModuleName/Setup

    2=> Now you have to update the version of the module from the module.xml

    After updating these files, update your custom product attribute’s scope in your custom module in your Magento 2 instance by terminal run following command in your magento2 root directory.

    now, the scope of the attribute changes to the Global

    is_global flag is used instead of global in updating the scope of an attribute.

    Hope it will help you. Thank you.


    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


  • Shaun Lewandowski
    this helped a lot! thanks!
    • Rajat Singh (Moderator)
      You are most welcome.
  • Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again