Skip Navigation

[Resolved] Woocommerce single product template for only one product

This support ticket is created 4 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by JamesS2731 4 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1612077

Tell us what you are trying to do? I'm trying to create a single product template for only one product (i.e. no all single products)

I know that I can create a template for all products, but wondered how to just template this one product.

Is there any documentation that you are following? I did gin this article concerning multiple templates per category, but wondered how to call the content template from within a template (or any other suggestions).

Is there a similar example that we can see? NO

What is the link to your site? hidden link

Any thoughts welcomed.
Best regards
James

#1612687

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Thank you for getting in touch.

If you want a template for one specific product then you can create a new content template by going to Toolset -> Content templates and create it from there.

The next thing is that you shouldn't assign this template to any Post type, rather just click the option "Don't assign to any post type"

Once you've created the content template you can then go to that specific product and assign that content template to that specific product using the content template selector from your post edit screen.

This should be on the right hand side of your edit screen for your Product.

Please let me know if this helps..

Thanks,
Shane

#1612715

Hi Shane,

Many thanks for your quick response. Yep, I was hoping that. I tried that but it’s not overriding the default WooCommerce template.

Is there anything else I can try?

Kind regards
James

#1612893

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Do you have our Woocommerce Views plugin installed?

Unless this plugin is installed you won't be able to make changes to the default product template.

You can download the Woocommerce views plugin from the link below.
https://toolset.com/account/downloads/

You will just need to install and activate and then you can create your content template.

Please let me know if this helps.

Thanks,
Shane

#1612993

Hi Shane, I do have it installed and activated, but I don't want to choose a template through it as that will affect all products. I just want to re-template one product.

In this instance, I want to template a product selling membership, but leave the rest of the products in the shop untouched.

As such, I"m looking for another method for that product to use a content template independently to all other products.

Does that make sense?

Kind regards
James

#1613051

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

In that case you won't be able to do it because our Woocommerce views plugin needs to be able to overwrite the template.

Without this then you won't be able to create a specific template for the single product, at least not with our Toolset plugin.

You will need to modify the Product template directly itself to build a specific template for that specific plugin.

Thanks,
Shane

#1613097

Hi Shane,

Thats what I thought. If I create the template manually (single-product-custom.php for instance) and get the one product to use it, can I still add Toolset shortcodes to the template? It's a lot easier to use those than to wade through Woo's myriad of template parts.

Kind regards
James

#1613915

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi James,

Yes you are able to use the Toolset Shortcodes in your template files.

You can use the do_shortcode function that wordpress provides to use the shortcodes directly in the template file.
https://developer.wordpress.org/reference/functions/do_shortcode/

Please let me know if this helps.
Thanks,
Shane

#1614029

Many thanks Shane, that's perfect. That'll help loads.

Kind regards
James