Multiproduct firms often diversify into technologically related activities to exploit efficiencies of joint production; however, unrelated products in the company’s portfolio provide access to distinct markets and can help to avoid industry-specific shocks. Yet, the underlying mechanisms of related and unrelated diversification are still poorly understood. Here we investigate diversification decisions of firms in periods when corporations’ markets are hit by a demand shocks. In these times, cost efficiency considerations might drive firms to reduce costs by narrowing product portfolios and focusing on combinations of technologically related products, in which economies of scope and mutual capabilities can be exploited. To test this hypothesis, we consider two measures of demand shocks, decreasing sales volumes on the product market and increasing import competition; and analyze their association with changes of product portfolios of Hungarian firms in the 2003-2012 period. We find that production has become more coherent in terms of technological relatedness after firms were exposed to demand shocks. Evidence suggests related adjustment of firm production after demand shocks such that products unrelated to firms’ core product are dropped from the portfolio but related products are added.