Your second option will be much quicker, but a bit more daring.
You must leave your dress unbuttoned, and go to the cashier and pay for the items in your basket. You may hold your dress closed with your one free hand, but you may not refasten it until you have paid and exited the store.
And remember: you may only refasten ONE button on your dress.