Heavy metal contaminants in vegetable oils can cause irreversible damage to human health. In this study, the quantitative detection of Cd in vegetable oils was investigated based on Raman spectroscopy combined with chemometric methods. The necessary preprocessing of the Raman signal was performed using baseline calibration and the Savitzky–Golay method. Three variable optimization methods were applied to the preprocessed Raman spectra. Namely, bootstrap soft shrinkage, multiple feature spaces ensemble strategy with least absolute shrinkage and selection operator, and competitive adaptive reweighted sampling (CARS), respectively. Partial least squares regression (PLSR) modeling for the determination of Cd in vegetable oils. The results show that three variable optimization algorithms improved the predictive performance of the model. Among them, the CARS–PLSR model has strong generalization performance and robustness. Its prediction coefficient of determination () was 0.9995, the root mean square error of prediction was 0.3533 mg/kg, and the relative prediction deviation was 44.3748, respectively. In summary, rapid quantitative analysis of Cd contamination in vegetable oils can be realized based on Raman spectroscopy combined with chemometrics.