Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to Add a Section to Product tab in WooCommerce

woocommerce-full-size-logo

In this Tutorial, I will explain how to add a section to product tab in Woocommerce with an example.

If you are a plugin developer and want to add a new section in product Tabs in WooCommerce, then keep your close attention in this tutorial as I am going to share the WooCommerce hacks to add a section in product tabs.

woocommerce-full-size-logo

How to Add a Section to Product tab in WooCommerce

Let’s create a section in product tab for the “slider”.

While creating a new section in product tab, the first thing we need to do is adding a new section by using the WooCommerce filters woocommerce_get_sections_products.

Now open the product tab and you will see another section as “WC Slider”.

woocommerce section in product tab

Lets create a form for this section. Copy the below code and ad it to your functions.php file in case you don’t want to create your plugin otherwise put below code in your plugin file.

 __( 'WC Slider Settings', 'text-domain' ), 'type' => 'title', 'desc' => __( 'The following options are used to configure WC Slider', 'text-domain' ), 'id' => 'wcslider' );
        // Add first checkbox option
        $settings_slider[] = array(
            'name'     => __( 'Auto-insert into single product page', 'text-domain' ),
            'desc_tip' => __( 'This will automatically insert your slider into the single product page', 'text-domain' ),
            'id'       => 'wcslider_auto_insert',
            'type'     => 'checkbox',
            'css'      => 'min-width:300px;',
            'desc'     => __( 'Enable Auto-Insert', 'text-domain' ),
        );
        // Add second text field option
        $settings_slider[] = array(
            'name'     => __( 'Slider Title', 'text-domain' ),
            'desc_tip' => __( 'This will add a title to your slider', 'text-domain' ),
            'id'       => 'wcslider_title',
            'type'     => 'text',
            'desc'     => __( 'Any title you want can be added to your slider with this option!', 'text-domain' ),
        );
        
        $settings_slider[] = array( 'type' => 'sectionend', 'id' => 'wcslider' );
        return $settings_slider;
    
    /**
     * If not, return the standard settings
     **/
    } else {
        return $settings;
    }
}

How to Add a Section to Product tab in WooCommerce

Refresh the Admin page, you will see the new section added as “WC Slider” with the basic options. You can change or customize the above code as per your requirement.

Liked this tutorial? Do Like & share with your friends 🙂

The post How to Add a Section to Product tab in WooCommerce appeared first on FreeWebMentor.



This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here

Share the post

How to Add a Section to Product tab in WooCommerce

×

Subscribe to Programming Blog Focused On Web Technologies

Get updates delivered right to your inbox!

Thank you for your subscription

×