This paper studies the limit cycle bifurcation problem of a class of piecewise smooth differential polynomial systems of degree n by perturbing a piecewise cubic polynomial system having a generalized heteroclinic loop with a cusp and a nilpotent saddle. First, we provide all possible phase portraits of the unperturbed system on the plane with crossing periodic orbits and obtain a condition for the appearance of a generalized heteroclinic loop with a cusp and a nilpotent saddle by qualitative theoretical knowledge. Then, we investigate the algebraic structure of the first order Melnikov function and give its asymptotic expansion near the generalized heteroclinic loop with the help of analytical skills. Finally, we employ the expansion together with its coefficients to obtain the existence of at least 3n−1 limit cycles.