Hand-me-down detergent smells

I’m a big fan of hand-me-downs and secondhand clothes for myself and baby, but I don’t know what to do about the aggressive detergent smell they often bring with them. I soak in vinegar, use borax, wash a billion times (which isn’t eco-friendly), and hang outside, to no avail. Does anyone have a surefire way to make the detergent smell go away? It literally gives me a headache.