Skip Navigation

[Cerrado] Woo commerce and Content Template for Variable product type ( not single product)

This support ticket is created hace 10 años, 1 mes. 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
- 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 10:00 – 19:00 -
- - - - - - -

Supporter timezone: Europe/Madrid (GMT+01:00)

This topic contains 1 respuesta, has 2 mensajes.

Last updated by Caridad hace 10 años, 1 mes.

Assigned support staff: Caridad.


and Thanks very much for your tutorial to learn "how to add e-commerce functionality to any WordPress site using Toolset"
In this tutorial and in your demo, your sample code is a view template to display woo commerce single product type
How can we create a view template to display variable product (including displaying select fields on front end for variable attributes like a color choice for the product before displaying the price corresponding ) ?


Dear Cheikhna,

WooCommerce templates work with action hooks. These actions, when called, include the necessary code to render the dropdowns and so on. You wont be able to go that far with a Content Template because there is no way to run an action from it.

For example, the default WooCommerce template includes this line to render the dropdown:

do_action( 'woocommerce_single_product_summary' );

We cant run that code from within a Content Template, so we have to turn it into a shortcode. Add these lines to functions.php in your theme:

add_shortcode('do-action', 'do_action_shortcode');
function do_action_shortcode($atts, $content = '') {
  $out = ob_get_contents();
  return $out;

And include this code in your Content Template to show the product summary:


Please let me know if there is anything else that I can assist you with.


El debate ‘[Cerrado] Woo commerce and Content Template for Variable product type ( not single product)’ está cerrado y no admite más respuestas.