-2

so I am building a woocommerce site for software and i ran into an issue. There are free software that should redirected to an external site to download it, but there are also software that are premium and cost money. So basically i want to have 2 product templates: a normal one with price, cart, etc... and another one that has a button (lets say download) that redirects to an external website, without the cart, price and so on. Is it possible to do without doing the code myself, is there a plugin for that? Commercial plugins are also an option, but would like to find a solution that does not require that.

Moon
  • 4,014
  • 3
  • 30
  • 66

1 Answers1

0

Into the WooCommerce files structure you will find

single-product.php

You can consider this file for the first product template.

If you want to add a second product template, you'll have to create a category ("download") and to use this code from @helgatheviking

add_filter( 'template_include', 'so_43621049_template_include' );

function so_43621049_template_include( $template ) {
  if ( is_singular('product') && (has_term( 'download', 'product_cat')) ) {
    $template = get_stylesheet_directory() . '/woocommerce/single-product-download.php';
  } 
  return $template;
}

So now you should be able to use single-product-download.php as file for your second template.

jjj
  • 965
  • 8
  • 23