Ideally, you can return it from where you purchased it.
Wait, you said stopped working after you opened it? Why did you open it to begin with?
Nintendo returns are a bit of a hassle but doable, but if they can’t guarantee a 1-1 replacement, you might be on the hook for a swap (I don’t know what this takes to do or feasibility of it), or, may be sell the replacement and use the money to buy an exact replacement online?
I can’t think of any other avenues to get you whole. I love the Switch, but joy-cons are trash.