1. Home
  2. Knowledge Base
  3. WooCommerce Product Table
  4. Product Table Shortcode Options
  5. Displaying shortcodes in the product table

Displaying shortcodes in the product table

The shortcodes option tells WooCommerce Product Table to display content generated by any shortcodes used on your site. It also tells the table to render any HTML or other formatting from your products, instead of displaying it as plain text.

Examples of shortcodes in a product table

There are lots of reasons why you might want to display shortcodes, HTML or other formatting in a product table. For example:

  • WordPress provides several built-in shortcodes for displaying audio files, embedded videos, media playlists and image galleries. These can be displayed directly in a product table.
  • Your theme or another plugin might also provide shortcodes, for example to display buttons or icons. You can display these in a product table.
  • You might want text formatting such as bold, paragraph breaks or hyperlinks to appear in the table, instead of having this stripped out.

Why don’t my shortcodes display in the table?

By default, shortcodes is set to false which will remove all shortcodes from your table, as well as disabling other formatting such as HTML. This is because:

  1. Processing shortcode content can take a significant amount of time – especially for large tables – so enabling them can have a performance impact on your site.
  2. Shortcodes often add HTML to the content which makes it difficult to limit content to a set number of words (see description_length). For this reason, if you enable shortcodes, then the full description is always displayed and the description_length option is ignored.

How to display shortcode content in WooCommerce Product Table

You can display shortcode and other formatting in the table by adding shortcodes="true" to the product table shortcode.

Once you’ve done this, you can add shortcodes to the description, short-description or any custom field column.

Example:

[product_table columns="image,name,description" shortcodes="true"]

Was this article helpful?

Related Articles