In this paper, a new class of two-dimensional nonlinear variable-order fractional optimal control problems (V-OFOCPs) is introduced where the variable-order fractional derivative is defined in the Caputo type. The general procedure for solving theses systems is expanding the state variable and the control variable based on the Legendre cardinal functions in the matrix form. Hence, we derive their operational matrix of derivative (OMD) and operational matrix of variable-order fractional derivative (OMV-OFD). More significantly, some properties of these basis functions are proved to be exploited in our approach. Using these achieved results, we simply expand the matrix form of the nonlinear performance index in terms of the Legendre cardinal functions and subsequently convert it to an algebraic equation. We emphasize that it is a valuable advantage of applying cardinal functions in approximation theory. Then, we implement the OMD and the OMV-OFD of the Legendre cardinal functions to transform the variable-order fractional dynamical system to a system of algebraic equations.Next, the method of constrained extremum is applied to adjoin the constraint equations including the given dynamical system and the initial-boundary conditions to the performance index by a set of undetermined Lagrange multipliers.Finally, the necessary conditions of the optimality are derived as a system of nonlinear algebraic equations including the unknown coefficients of the state variable, the control variable and the Lagrange multipliers. The applicability and efficiency of the proposed approach are investigated through the various types of test problems. KEYWORDS legendre cardinal functions, operational matrix of derivative (OMD), operational matrix of variable-order fractional derivative (OMV-OFD), variable-order fractional optimal control problems