Establishing an analytical technique for the simultaneous determination of Pb2+ and Hg2+ at edible products is of great importance. Therefore, in this research, the applicability of a recently synthesized melamine-based covalent organic framework (Schiff base network1 (SNW1)) as a novel modifier for the simultaneous measurement of Pb2+ and Hg2+ was investigated. At first, the complexation of SNW1 with Pb2+ and Hg2+ ions was evaluated by density functional theory calculations and the results indicated the complexation process is spontaneous, exothermic, experimentally possible, and thermodynamically favorable. Then, the morphology, chemical composition and electroanalytical function of the developed modified glassy carbon electrode were completely characterized by Fourier-transform infrared spectroscopy (FT-IR), energy dispersive X-ray spectroscopy (EDS), scanning electron microscopy (SEM), cyclic voltammetry (CV), square wave voltammetry (SWV) and Electrochemical impedance spectroscopy. Afterward, all of the effective experimental factors including pH, supporting electrolyte type and instrumental parameters were optimized by one factor at a time method. Under optimized conditions, the designed sensor showed a linear response over the concentration ranges of 0.01-0.3 and 0.05-0.3 µmol L -1 for Pb2+ and Hg2+ respectively with a detection limit of 0.72 and 12.11 nmol L-1. The selectivity of the developed sensor over a wide range of ionic species was examined and the findings indicated the electrode has an admissible selectivity towards both analytes. In the end, the designed electrochemical sensor was successfully employed for simultaneous measurement of Pb2+ and Hg2+ at different edible samples including drinking water, white rice, black tea, red pepper, and marine salt and the obtained results were compared with a standard reference analytical technique.