Skip to content

Snippet: Override WooCommerce Single Products with a WPBakery Template

Important: You can now select your WooCommerce template via the Customizer! No need for custom code unless you want to do something more complex like assign different templates to different product types.

This code snippet will allow you to override all WooCommerce single product content with a Templatera template.

/**
 * Display a custom template instead of the default WooCommerce product template.
 *
 * @link https://total.wpexplorer.com/docs/snippets/woo-single-product-template/
 */
add_filter( 'wc_get_template_part', function( $template, $slug, $name ) {
	if ( 'content-single-product' ) {
		echo do_shortcode( '[templatera id="YOUR_TEMPLATE_ID"]' );
		return;
	}
	return $template;
}, 10, 3 );
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)
Back To Top