Q:

How to hide a custom text attribute which displayed in product edit backend

I am using Magento 2.2.5
I need to hide a text attribute which I'm using to save serialized data of custom options of product.

I think this can be done using adminhtml/ui_component/product_form.xml file, but don't know how.
Thanks

A:

You can try below steps to hide product fields
Step 1:
create catalog_product_edit.xml under app/code/Vendor/Module/view/adminhtml/layout
File : catalog_product_edit.xml
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\Template" name="myattribHide" before="before.body.end" template="Vendor_Module::product/edit/fieldhide.phtml" />
</referenceContainer>  

Step 2: 
Create file fieldhide.phtml under app/code/Vendor/Module/view/adminhtml/templates/product/edit
File : fieldhide.phtml
<script>
    require([
        'jquery',
        'uiRegistry'
    ], function($,uiRegistry){
        uiRegistry.get("product_form.product_form.content.container_yourcustomfield.yourcustomfield", function (element) {
         element.hide();
      });        
    })
</script>

Note : Please replace "yourcustomfield" with your attribute code
Step 3:
Please remove static files and refresh cache

