Making assortment decisions is becoming an increasingly difficult task for many retailers worldwide as they implement omnichannel initiatives. Discrete choice modeling lies at the core of this challenge, yet existing models do not sufficiently account for the complex shopping behavior of customers in an omnichannel environment. In this paper, we introduce a discrete choice model called the multichannel attraction model (MAM). A key feature of the MAM is that it specifically accounts for both the product substitution behavior of customers within each channel and the switching behavior between channels. We formulate the corresponding assortment optimization problem as a mixed integer linear program and provide a computationally efficient heuristic method that can be readily used for obtaining high-quality solutions in large-scale omnichannel environments. We also present three different methods to estimate the MAM parameters based on aggregate sales transaction data. Finally, we describe general effects of the implementation of widely-used omnichannel initiatives on the MAM parameters, and carry out numerical experiments to explore the structure of optimal assortments, thereby gaining new insights into omnichannel assortment optimization. Our work provides the analytical framework for future studies to assess the impact of different omnichannel initiatives.