Мне нужно иметь возможность сохранить значения пользовательской вкладки с именем Свойства вина , которые есть у моего пользовательского продукта.
Я попытался использовать хук woocommerce_process_product_meta без везения. Я оставляю код, который я использую ниже
add_action( 'woocommerce_process_product_meta', 'save_wine_options_field' );
function save_wine_options_field( $post_id, $post ) {
//! Mas Vendidos
$wine_best_seller = isset( $_POST['_wine_best_seller'] ) ? 'yes' : 'no';
update_post_meta( $post_id, '_wine_best_seller', $wine_best_seller );
//! Top Love
$wine_top_love = isset( $_POST['_wine_top_love'] ) ? 'yes' : 'no';
update_post_meta( $post_id, '_wine_top_love', $wine_top_love );
//! Añada del vino pa_idgl_best_sellers
$wine_vintage_select = $_POST['_wine_vintage_select'];
if( !empty( $wine_vintage_select ) ){
update_post_meta( $post_id, '_wine_vintage_select', esc_attr( $wine_vintage_select ) );
} else {
update_post_meta( $post_id, '_wine_vintage_select', '' );
}
//! Texto añada del vino
$wine_vintage_text = $_POST['_wine_vintage_text'];
if ( isset( $wine_vintage_text ) ) {
update_post_meta( $post_id, '_wine_vintage_text', sanitize_text_field( $wine_vintage_text ) );
}
}
Спасибо