Skip to content

Woo Product Open All Accordion Toggles by Default

When using the accordion style WooCommerce product tabs in Total, you can normally set them to either all closed or with just the first tab open on page load. If you’d prefer to have every tab expanded by default, you can use the following snippet.

add_filter( 'shortcode_atts_vcex_toggle', function( $atts ) {
	static $open_all_woo_tabs = null;
	if ( $open_all_woo_tabs === null ) {
        $open_all_woo_tabs = (
            is_singular( 'product' )
            && did_action( 'woocommerce_single_product_summary' )
            && ! did_action( 'woocommerce_product_after_tabs' )
        );
    }
    if ( $open_all_woo_tabs ) {
        $atts['state'] = 'open';
    }
	return $atts;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Related Snippets
Back To Top