• Resolved dachilla78

    (@dachilla78)


    Hi,

    first of all I love the plugin. Problem is, I just found out about it now and I already have more than 1000 products in my Woocommerce. Assigning a tab item by item would be so much work I could employ someone for a year. Is there a way to assign a specific tab to all products (and also to the translations – WPML).

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Tracy Levesque

    (@liljimmi)

    ?????? YIKES, Inc. Co-Owner

    Hello @dachilla78

    You can actually accomplish that with the Pro version of our plugin.

    As for WPML, @fmixell can chime in on that.

    Thank you,
    -Tracy

    @dachilla78,

    You can add a filter to your themes functions.php that detects the WPML current language. In the following code sample we’re asking WooCommerce to pass us all the tabs and then we’re asking WPML what the language is. From here you can target your tabs by using their tab name.

    In the example you’ll see theres a tab named Technical Data so we access it with all lowercase and a dash instead of a space. Then you have the next piece which is targeting that tabs title.

    add_filter( 'woocommerce_product_tabs', 'yikes_rename_default_woocommerce_tabs', 98, 1 );
    
    function yikes_rename_default_woocommerce_tabs( $tabs ) {
    	$lang = apply_filters( 'wpml_current_language', NULL );
    
    	if ( $lang == 'it' ) {
    		if ( isset( $tabs['technical-data'] ) ) {
    			$tabs['technical-data']['title'] = 'Dati Tecnici';
    		}
                    // ... other tabs ...
    	}
    
            return $tabs;
    }

    With this filter you can customize your tabs in any way you’d like based on whatever language you’d like to support.

    For more information on how this filter works ( it’s part of WooCommerce ) you can check out all these examples that show you how to modify priority and remove default tabs.

    https://docs.woocommerce.com/document/editing-product-data-tabs/

    If you have any questions about translation let me know!

    – Freddie

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assign tab to all products at once’ is closed to new replies.