• I cannot seem to find proper documentation to get template by product type. I am able to find documentation to get by category but that is not what I want.

    Can anyone point me to the right direction to get template by product type for single-product.php?

Viewing 2 replies - 1 through 2 (of 2 total)
  • @nward85 you’ll probably need to edit the single-product.php file after copying it to your theme / child theme. There you can check the type and have different code for different types.

    Thread Starter nward85

    (@nward85)

    I already copied to my theme. So far the only code online I found is:

    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php if ( is_product( 'listing' ) ) {
    
    woocommerce_get_template_part( 'content', 'single-product-listing' );
    
    }else{
    
    woocommerce_get_template_part( 'content', 'single-product' );
    
    } ?> 
    
    <?php endwhile; // end of the loop. ?>

    But it does not work. Any ideas?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom Product Type Template’ is closed to new replies.