I had this happen to me at Kohls a few years ago. I finally returned 2 pairs of black and dark indigo jeans because I couldn't get the smell out after numerous washings. I tried everything to get the smell out. I don't know how I missed the odor when I tried them on.
Now I smell every pant before I try them on and purchase. Last week I picked up a trouser jean and sniffed it and put it right back on the pile - the odor was enough to make me refuse to take it to the dressing room. I'm sure people think I am kooky when they see me do this. I would never buy a dark pant online because I would be afraid it would stink.