You can try them on in the local store and then buy the same size online. Works wonders for some products like brand sneakers or jeans.
Won't happen until enough brick and mortar stores close that the remaining ones can get away with it, though.
My understanding is that this is because the denim is stacked and then die cut in the factory. Since denim is highly deformable, the cut outs from the top of the stack are not the same size as the cut out from the bottom of the stack. And this can lead to considerable size variance within the "same" pairs of pants.
That's why it's a good idea to try on two pairs of the exact "same" pants if the fit is close, but not quite right. YMMV.
If I buy two of the same pair, the match each other throughout their lifespan.