Skip Navigation

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

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 1 respuesta, has 2 mensajes.

Last updated by Caridad hace 7 años, 9 meses.

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.