The significance of last‐mile logistics in the healthcare supply chain is growing steadily, especially in pharmacies where the growing prevalence of medication delivery to patients' homes is remarkable. This paper proposes a novel mathematical model for the last‐mile logistics of the pharmaceutical supply chain and optimizes a pharmacy's logistical financial outcome while considering medication synchronization, different delivery modes, and temperature requirements of medicines. We propose a mathematical formulation of the problem using mixed‐integer linear programming evolved from the actual problem of an outpatient pharmacy of a Dutch hospital. We create a case study by gathering, preparing, processing, and analyzing the associated data. We find the optimal solution, using Python MIP package and the Gurobi solver, which indicates the number of order batches, the composition of these batches, and the number of staff related to the preparation of the order batches. Our results show that our optimal solution increases the pharmacy's logistical financial outcome by 34%. Moreover, we propose other model variations and perform extensive scenario analysis to provide managerial insights applicable to other pharmacies and distributors in the last step of cold supply chains. Based on our scenario analysis, we conclude that improving medication synchronization can significantly enhance the pharmacy's logistical financial outcome.