ID, '_composition', true); echo '
'; woocommerce_wp_textarea_input([ 'id' => '_composition', 'label' => 'Состав', 'desc_tip' => true, 'description' => 'Введите состав товара', 'value' => $composition ]); echo '
'; }); /* Вывод пользовательских табов */ // add_action('woocommerce_product_data_panels', function () { // global $post; // $feeding = get_post_meta($post->ID, '_feeding_recommendations', true); // echo '
'; // woocommerce_wp_textarea_input([ // 'id' => '_feeding_recommendations', // 'label' => 'Рекомендации по кормлению', // 'desc_tip' => true, // 'description' => 'Введите рекомендации по кормлению', // 'value' => $feeding // ]); // echo '
'; // }); // add_action('woocommerce_product_data_panels', function () { // global $post; // $important = get_post_meta($post->ID, '_important', true); // echo '
'; // woocommerce_wp_textarea_input([ // 'id' => '_important', // 'label' => 'Важно', // 'desc_tip' => true, // 'description' => 'Введите важную информацию', // 'value' => $important // ]); // echo '
'; // }); // woocommerce_product_options_inventory_product_data ] add_filter('woocommerce_product_data_tabs', function ($tabs) { $tabs['composition_tab'] = array( 'label' => 'Состав', 'target' => 'composition_product_data', 'class' => array('composition_tab'), 'priority' => 60, ); // shipping_product_data // shipping_options // shipping_tab // $tabs['feeding_tab'] = array( // 'label' => 'Рекомендации по кормлению', // 'target' => 'feeding_product_data', // 'class' => array('feeding_tab'), // 'priority' => 61, // ); // $tabs['important_tab'] = array( // 'label' => 'Важно', // 'target' => 'important_product_data', // 'class' => array('important_tab'), // 'priority' => 62, // ); return $tabs; }); /* сохраненение кастомных полей */ add_action('woocommerce_process_product_meta', function ($post_id) { if (isset($_POST['_composition'])) { update_post_meta($post_id, '_composition', sanitize_textarea_field($_POST['_composition'])); } // if (isset($_POST['_feeding_recommendations'])) { // update_post_meta($post_id, '_feeding_recommendations', sanitize_textarea_field($_POST['_feeding_recommendations'])); // } // if (isset($_POST['_important'])) { // update_post_meta($post_id, '_important', sanitize_textarea_field($_POST['_important'])); // } }); /** * End: Добавление табов и полей в стандартной форме редактирования товара Woocommerce */