Apple has been ordered by a court to remove iPhone 7 and iPhone 8 models from its German stores.