A domain $D$ satisfies your condition if and only if it is an LPI domain with trivial Picard group (which can be realized as the group of invertible fractional ideals mod nonzero principal fractional ideals). This would include the case of UFDs. LPI domains are discussed, for example, in http://www.lohar.com/researchpdf/locallyprincipalisinvertible4.pdf and http://rms.unibuc.ro/bulletin/pdf/56-1/gabellis.pdf
Any Mori (hence any Noetherian) domain is an LPI domain, hence a Mori domain satisfies your condition if and only if it is has trivial Picard group. However, there exist Mori, and even Noetherian, domains with trivial class group that are not UFDs. See Seeking Noetherian normal domain with vanishing Picard group but not a UFDSeeking Noetherian normal domain with vanishing Picard group but not a UFD