1. Knowledge Base
  2. WooCommerce Product Table
  3. 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 $args – 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.

Example
$args = array( 
  'columns' => 'name,price,add-to-cart',
  'filters' => true,
  'category' => 'featured'
);
$table = wc_get_product_table( $args );

wc_the_product_table

Similar to the above function, but will print, rather than return, the product table in the current location.

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

array $args – The list of arguments to create the product table.

Still need help?

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

Related Articles