If your iPhone has any damage that impairs the replacement of the battery, such as a cracked screen, that issue will need to be resolved prior to the battery replacement. In some cases, there may be a cost associated with the repair.
Warranty will only cover the cost of the replacement if the battery fails diagnostics (below 80%)
Out of Warranty
iPhone X, iPhone XS, iPhone XS Max
iPhone SE, iPhone 6, iPhone 6 Plus, iPhone 6s, iPhone 6s Plus, iPhone 7, iPhone 7 Plus, iPhone 8, iPhone 8 Plus, and all other eligible models