Automatically hide and fill fields based on item group

Hi! I have a massive amount of items but only split into 3 categories: A, B, and C. C is a final product made by a combination of A and B. To simplify the process of adding new items, I’d like to hide and fill fields based on the group of the item (which is specified in the quick info box when creating the item). For example, every item of category B is supplied from the client, so I would like to auto-fill that and hide it.
I believe that this can be done using a custom script in the Item doctype, but because of the lack of documentation and examples, I don’t know how to get the item group on validation and then hide and fill the other fields.

Thanks for your help!

I usually create a new section for the given item group. Then we can set it’s visibility via its “Depends On” field. Like

eval:doc.item_group=='METAL'

Then you can add another section break and you can set it’s depends on field like:

eval:doc.item_group=='PLASTIC'

Is that solve your problem?