Motivated by the booming online grocery market and the extensive use of contingent free‐shipping (CFS) policies in the e‐grocery industry, we investigate the optimal CFS and pricing decisions for online grocers. Under a CFS policy, consumers enjoy free shipping for orders exceeding a certain threshold value; otherwise, they are charged a flat fee for orders below this threshold. We adopt a utility‐based model to capture consumers' behavior of purchasing additional items to qualify for free shipping under a CFS policy and analyze its impact on policy structure and consumer surplus. We characterize the e‐grocer's optimal pricing and CFS policy and find that consumer heterogeneity and demand distribution lead to different forms of the optimal shipping policy. When consumer heterogeneity is large enough, the optimal policy induces some consumers to top up and may allow some others to ship for free. In this case, the e‐grocer can charge a high‐profit margin. Otherwise, a top‐up option is unnecessary, and a flat‐rate shipping fee policy is optimal. Moreover, while the optimal policy never induces all consumers to top up when they are rational, it is possible to do so when consumers associate some psychological disutility with the shipping fee. Surprisingly, the total consumer surplus under the optimal policy may increase in the latter case. We further model a Stackelberg game between an e‐grocer and an offline channel and find that the difference between the e‐grocer's internal shipping cost and consumers' inconvenience cost of shopping offline is a main driver for market segmentation. Lastly, we show that a subscription‐based free‐shipping program, in addition to the jointly optimized CFS and pricing policy, cannot improve profits when consumers' order size and frequency are independent. Our findings help online grocers make operational and marketing decisions under the impact of consumers' top‐up behavior.