how to add custom fields in custom tab on woocommerce

How to add custom product tabs to the woocommerce single product page?

Home – Blog – How to add custom product tabs to the woocommerce single product page?

HOW TO ADD CUSTOM PRODUCT TABS TO THE WOOCOMMERCE SINGLE PRODUCT PAGE?

For adding custom product tabs to the Woocommerce single product there are 2 solutions.
1. Use a free/commercial plugin
2. Do it yourself

1. The easiest way to add custom tabs is to use a free plugin with limited functionalities or buy a commercial version of the plugin. The free version of the plugin has a limit to add one tab to your product page and doesn’t have an option to remove the current default tabs (description/attributes/reviews). Also the commercial version doesn’t have that kind of limits.

The commercial version of the plugin is called the WooCommerce Tab Manager and you can find it at the following link . WooCommerce Tab Manager gives you control over product page tabs. You can easily reorder tabs via drag-and-drop interface , create and delete tabs and share tabs with multiple products.

2. To edit/delete/add new tabs to your WooCommerce products you need to know a little bit of coding. We will help you to accomplish that with code snippets and detailed explanation.

You need to add all code snippets to your theme/childtheme functions.php file.
For every code you will need to add a filter and create a function. To trigger our function, we will create a filter with WordPress function add_filter ();. Detail explanation of the add_filter (); function you can find here. For all the tab changes we will use the woocommerce_product_tabs filter without custom function.

To remove specific tabs from WooCommerce product page, we will use the following code.

To re-order tabs you can easily change the priority for every tab with the same filter.

To Customize specific tabs from WooCommerce product page, we will use the following code.

Adding a custom tab. We will add an array with the following values for the title, priority and the callback function for our new tab. To set the title we will add New Custom Product Tab. To set the new tab after the Additional information tab we will add a priority 50. To display our custom content with the callback function called new_product_tab_content ().

Leave a Reply

Your email address will not be published. Required fields are marked *