KeBom KeBom - 1 year ago 41
PHP Question

How do I change code of a Single Product page

So I want to add a FAQ under SOME products. Normally I would probably just change the code in the single-product.php. But then I would change every single prodcut page to the same, right?

And since I cant choose different themes for products as you can do with normal pages I dont really know how to do that.

Thank you for reading and I hope that someone can help me! :)

Answer Source

for some of product if you wan to add FAQ then first list all products id in array

for ex in your single product page

$list_of_products = array('1','2','3','4','5');

check if you are viewing that product

$current_product = $product->id;
      //do something here (add FAQ block or html)

if you have different FAQ's then use if else if instead of if condition