A hierarchical 2 × 2 $2\times 2$ factorial design is a type of two-level trial design where the first intervention is randomized at the cluster level and the second intervention is randomized at the individual level. With a continuous outcome, the linear mixed model with a random intercept can be used for this design to estimate the treatment effects while accommodating the within-cluster correlations. Such a model often serves as the basis for the sample size and power calculation. However, recent evidence in cluster randomized trials has shown that the cluster-level intervention effect might differ across clusters, leading to extra variability in the outcomes. This paper extends the existing literature on designing hierarchical 2 × 2 $2\times 2$ factorial trials to address heterogeneous treatment effects across clusters. Under the generalized least squares framework, we consider models with or without an interaction between the two interventions, and derive sample size formulas for testing the controlled effects, the marginal effects, and the interaction effect between the two treatments. Simulation studies were conducted to verify our sample size formulas in finite samples. The context of hierarchical 2 × 2 $2\times 2$ factorial trial on suicide prevention is used for illustrating our methods.