Skip Navigation

[Geschlossen] 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.

Our next available supporter will start replying to tickets in about 7.04 hours from now. Thank you for your understanding.

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Caridad vor 8 Jahre, 12 Monate.

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.


Das Thema „[Geschlossen] Woo commerce and Content Template for Variable product type ( not single product)“ ist für neue Antworten geschlossen.