1

I know this may be slightly off topic, but this really is the best place to ask a question related to WooCommerce & WordPress.

I've search high and low for an answer to this question and there does not seem to be one.

I have a specific product under the category 'course'. I would like to create a custom template for this product which I can drop into my themes template files.

What would I need to name the file for it to override on this specific product only?

  • single-product-[slug].php
  • single-product-[category].php
  • single-product-[pageid].php
  • single-product-[productid].php

Please advise.

3 Answers 3

2

Override the template with a template_include filter.

1

you need to check the last specifications from woocommerce to override his template files.

https://docs.woocommerce.com/document/template-structure/

The last time i did it, i copy the template file with the structure of the folder from the woo plugins template directory under the active theme inside a folder named woocommerce with the same structure. You can get more info in the above link.

0

As woocommerce is basically just posts have you not tried single-productID.php so single-234.php

4
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
    – Gabriel
    Oct 27, 2015 at 20:06
  • Yes it does it states that if you add single- and the post / product id the it is specific for that post if you try it then you will see that does exactly what he is asking for Oct 27, 2015 at 20:16
  • 1
    Please elaborate on the answer. I can understand how this is a genuine attempt to provide an answer but it is phrased as a question, albeit a carelessly punctuated one.
    – s_ha_dum
    Oct 27, 2015 at 20:49
  • Basically copy single-product.php and rename to single-[productid].php and upload in your theme folder Oct 27, 2015 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.