Predicting wholesale pork prices effectively is essential to maintaining market stability. However, due to the nonlinearity, time-varying nature, multivariate structure, and close coupling of the factors influencing pig prices, developing a trustworthy prediction model has not been easy. This paper proposes the STL-Granger-AttGRU hybrid model to address this challenge. To begin, the STL approach is used to separate the time series of wholesale pork prices in the Chinese market into trend, seasonal, and residual sections. After deconstructing the data, we employ the LSTM and SARIMA models for training and modeling purposes. Crucial elements in the data are found using the Granger causality test. Different weights are then assigned to the input features using an attention mechanism. Finally, precise wholesale price projections for pork are produced by a GRU model. With an R2 of 0.99284, RMSE of 0.372, MAPE of 0.0129, and MAE of 0.2916, the STL-Granger-AttGRU model outperforms eight other frequently used models. Based on this evidence, it appears that the model makes predictions that are more accurate. The prediction approach used in this study is also widely applicable and might be extended to other fields for agricultural commodity price forecasting. We expect robust backing for the advancement of precise and sustainable agriculture.