Hello, I want to create additional tabs that will contain information in all products, but I did not find how to do this in this menu, can you tell me?
I did this via woocommerce hooks. And this was not displayed in the product card when viewing it, but if you opened the product in the admin panel, you could see the additional tab and the information written in it. How can I display it in your constructor?
So if you want to modify files and don't know how, you should contact your web developer. Item Policy says:
Item support does not include services to modify or extend the item beyond the original features, style, and functionality described on the item page. For customization services that will help you tailor the item to your specific requirements, we recommend contacting the author to see if they privately offer paid customization services or checking out the great service providers on Envato Studio.
We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.
Cookies are small text files that can be used by websites to make a user's experience more efficient.
The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.
This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.
You can at any time change or withdraw your consent from the Cookie Declaration on our website.
Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.
Please state your consent ID and date when you contact us regarding your consent.
Comments
Following the example of the “description” field - a text block in which I can set the basic text, but I can also edit it for each product separately.
Hi,
There is no setting for that, and you would have to use an external plugin to create additional tabs for products.
Best regards
I did this via woocommerce hooks. And this was not displayed in the product card when viewing it, but if you opened the product in the admin panel, you could see the additional tab and the information written in it. How can I display it in your constructor?
// Добавляем вкладку "Дополнительная информация"
function add_custom_product_tab( $tabs ) {
$tabs['custom_tab'] = array(
'label' => __( 'Дополнительная информация', 'mytheme' ),
'target' => 'custom_tab_content',
'class' => array( 'custom-tab' ),
'priority' => 50,
);
return $tabs;
}
add_filter( 'woocommerce_product_tabs', 'add_custom_product_tab' );
// Добавляем поле мета-товара для дополнительной информации
function add_custom_meta_field() {
$args = array(
'id' => 'custom_tab_content',
'label' => __( 'Дополнительная информация', 'mytheme' ),
'type' => 'textarea',
'description' => __( 'Введите дополнительную информацию о товаре', 'mytheme' ),
);
woocommerce_wp_textarea_input( $args );
}
function save_custom_meta_field( $post_id ) {
$custom_tab_content = $_POST['custom_tab_content'];
update_post_meta( $post_id, 'custom_tab_content', $custom_tab_content );
}
add_action( 'woocommerce_product_options_general_product_data', 'add_custom_meta_field' );
add_action( 'woocommerce_process_product_meta', 'save_custom_meta_field' );
// Добавляем текст по умолчанию для дополнительной информации
function add_default_custom_tab_content() {
$default_content = '<p>В этом разделе вы можете найти дополнительную информацию о товаре.</p>';
foreach (get_posts(array('post_type' => 'product')) as $product) {
if (!get_post_meta($product->ID, 'custom_tab_content', true)) {
add_post_meta($product->ID, 'custom_tab_content', $default_content, true);
}
}
}
add_action( 'woocommerce_init', 'add_default_custom_tab_content' );
// Отображаем контент вкладки "Дополнительная информация"
function custom_tab_content() {
$post_id = get_the_ID();
$custom_tab_content = get_post_meta( $post_id, 'custom_tab_content', true );
echo '<p>'. $custom_tab_content. '</p>';
}
What you ask for requires file customization, which, in reference to the Item Support Policy, is not allowed. http://themeforest.net/page/item_support_policy
So if you want to modify files and don't know how, you should contact your web developer. Item Policy says:
Item support does not include services to modify or extend the item beyond the original features, style, and functionality described on the item page. For customization services that will help you tailor the item to your specific requirements, we recommend contacting the author to see if they privately offer paid customization services or checking out the great service providers on Envato Studio.
Thanks