1. WooCommerce Product Table
  2. Developer Documentation

Template functions

wc_get_product_table

This function can be used in your theme or plugin to retrieve a product table, passing a list of arguments as an array.

Arguments
array- The list of arguments to create the product table. Argument names are the same as those used in the product table shortcode. List based arguments (such as the columns option) can be passed as a comma-separated string or an array.

Return
string - The complete HTML for the product table table.

$args = array( 
  'columns' => 'name,description,price,buy',
  'filters' => true,
  'category' => 'featured'
);
$table_html = wc_get_product_table( $args );

wc_the_product_table

Similar to the above function but this function outputs (echos) the table to the page, rather than returning the HTML.

Arguments
array - The list of arguments to create the product table.

// Print a product table after the main content for a page.
the_content();

wc_the_product_table( array( 
   'category' => 'featured',
   'rows_per_page' => 5,
   'variations' => true
) );

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.