When using our custom product tabs for WooCommerce plugin you can add custom tabs yourself, but you can also use WP All Import for importing multiple tab content data. In this guide we show how you can use an import job of WPAI to update custom tabs with ease.
Inside custom Fields settings of your import job create anew entry with
- Name: woocommerce_ultimate_tabs_custom
- Value -> click on field options > serialized
- Key: 1, 2, 3, 4 etc.
- Value: custom callback function:
[we_serialize_tab( {dataTabTitle[1]}, {dataTabDescription[1]}, "50")]
The above custom callback function needs to be added to the importer functions. Open the fucntion editor and add the function code (see below).
function we_serialize_tab($title, $content, $priority = 20) { if(empty($title)) { return ''; } if(empty($content)) { return ''; } $priority = intval($priority); $data = array( 'id' => uniqid(), 'title' => $title, 'content' => $content, 'priority' => $priority, ); return serialize($data); }
This code will create a serialized object of custom product tab data containing:
- unique id (you can also make that static if you want)
- title (the tab title)
- content (the text that will show in this tab)
- priority (default 20)
Now you can run your WP All Import job and custom product tabs for your products will be created automatically.