How do I hide fields based on other field's value?
This can be handled via AdminPresentation annotations.
https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/admin/admin-metadata-overrides
In the extended class's fields, you can use the AdminPresentation's showIfFieldEquals field.
https://github.com/BroadleafCommerce/BroadleafCommerce/blob/broadleaf-5.2.5-GA/common/src/main/java/org/broadleafcommerce/common/presentation/AdminPresentation.java#L389
You can do something like the following (which we use in AdvancedProductImpl).
@AdminPresentation(friendlyName = "AdvancedProduct_hasChildProductAddOns",
group = GroupName.General,
order = FieldOrder.URL + 2000,
defaultValue = "false",
showIfFieldEquals = { @FieldValueConfiguration(
fieldName = "embeddableAdvancedProduct.type",
fieldValues = { "PRODUCT", "BUNDLE" })
})