Car mileage deduction for a trip that was partially for business

When calculating the number of miles driven for business, what is the correct way to handle a scenario in which I drove to a store to buy something for the business, but also picked up something for personal use? Does the business mileage end upon arrival at the store, or is it based on the % cost of what I bought for business vs personal, or something else?