This article presents the utilization of a shunt active power filter (SHAPF) in combination with an Energy Storage System (ESS) and a Solar Energy System (SES). Voltage source converters (VSC) are connected in parallel to a direct current (DC) bus. The membership function (MSF) of fuzzy logic controller (FLC) for the shunt control system is optimally adjusted using the golden balloptimization algorithm (GBOA). The present effort aims to achieve the following primary objectives: 1) Quick implementation to stabilize the voltage of the DC Link capacitor (DCLCV); 2) Mitigation of harmonics and improvement of power factor (PF); 3) Satisfactory performance under load as well as solar power varying conditions. The effectiveness of the optimally designed controller is evaluated by studying four test scenarios with grid and standalone conditions. The results are then compared to the existing sliding mode (SMC) and fuzzy logic controllers (FLC).