Home Forums General Issues need extra tabs in wooCommerce product page


need extra tabs in wooCommerce product page

  • Hello all……
    my requirement is to have extra tabs in wooCommerce product page(few tabs beside description)
    The content to these tabs has to be populated from CSV or Excelsheet…..

    I’ve installed ACF plugin ,created fields with text area….
    where do i edit my backend….please help

  • ACF cannot be used to add tabs to the WC product information area.

  • To add extra tabs to the WooCommerce product page and populate their content from a CSV or Excel sheet using the Advanced Custom Fields (ACF) plugin, you’ll need to follow these steps:

    Install and activate the ACF plugin from the WordPress plugin repository.

    Create a new field group in ACF that will contain the text area fields for each tab. Set the location rule to “Post Type” and select “Product” to ensure the field group is associated with the WooCommerce product post type.

    Add a text area field for each tab you want to create. You can customize the field settings as needed, such as the field label and field name.

    Once you have set up the field group, navigate to a WooCommerce product edit screen in the WordPress backend.

    Scroll down to the ACF section, where you should see the fields you created for the tabs. Enter the desired content for each tab in the corresponding text area fields.

    To display the content of these tabs on the frontend, you will need to modify your product page template. Locate the file single-product.php in your theme’s directory. If it doesn’t exist, you can create a copy of woocommerce/templates/single-product.php and place it in your theme’s directory.

    Edit the single-product.php file and find the section where the product description is displayed. It is typically located within the <div> with the class woocommerce-tabs.

    Add the following code inside the <div> with the class woocommerce-tabs:


    <?php if (have_rows('tab_fields', get_the_ID())) : ?>
        <ul class="tabs">
            <?php while (have_rows('tab_fields', get_the_ID())) : the_row(); ?>
                <li><a>"><?php echo esc_html(get_sub_field('tab_title')); ?></a></li>
            <?php endwhile; ?>
        <?php while (have_rows('tab_fields', get_the_ID())) : the_row(); ?>
            <div id="<?php echo sanitize_title(get_sub_field('tab_title')); ?>">
                <?php echo wpautop(get_sub_field('tab_content')); ?>
        <?php endwhile; ?>
    <?php endif; ?>

    This code retrieves the ACF repeater field values for the tabs and generates the HTML structure for the tabs and their content. Each tab is generated based on the field values you entered in the backend.

    Save the modified single-product.php file.

    Now, when you view a WooCommerce product page on the frontend, you should see the additional tabs with their respective content populated from the ACF fields

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.