An IoT infrastructure to continuously monitor the fresh food supply chain can quickly detect food quality and contamination issues and thereby reduce costs and food wastage. This, in turn, involves several challenges including the development of inexpensive quality/contamination sensors to be deployed in a fine grain manner in the food boxes, technologies for sensor level communications, online data management and analytics, and logistics driven by such analytics. In this paper, we study the issues related to the communication among sensing modules deployed in the fresh food boxes and thereby an automated localization of the boxes that may have quality/contamination issues. In this context we study the near-field magnetic induction (NFMI) based communication and localization, as the ubiquitous RF communications suffer high attenuation through the water/mineral rich tissue media. An accurate localization of the sensors inside boxes within the food pallets is very challenging in this environment. In this paper we propose a novel magnetic induction based localization scheme, and show that with a small number of anchor nodes, the localization can be done without any errors for boxes as small as 0.5 meter on the side, and with small errors even for boxes half as big.