WooCommerce links in Additional Information

Tag: woocommerce Author: chen6_9 Date: 2013-06-08

Is it possible to add links to the Additional Information tab at the bottom of each product page? My attributes are listed there, but some of them (including photography credits) should have URLs that are being stripped when they are listed.

How can I include an HTML link down here?

Other Answer1

As far as I know, you can't add HTML to product attributes in WooCommerce but I have a work around that might help:

  1. I use the plugin "WooCommerce Tab Manager" by SkyVerge from http://www.woothemes.com/products/woocommerce-tab-manager/. It's a paid plugin but well worth the money. This let's you make your own tabs that can be either shared or individual to each product that can contain full HTML, image or anything else that you can add to a regular post. You can also re-arrange and rename tabs on a shared or individual basis. Just knowing this much you might be able to figure it out for yourself but read on for more tips.

  2. If your store is already populated, view page source of an item with some attributes in the Additional Information tab and copy the table code. It will be inside of <div id="tab-additional_information" class="panel entry-content" style="display: block;">.

  3. Get into the relevant Edit Product screen and click the Tabs option that has been added to the bottom of the Product Data panel.

  4. Click the "Override Default Tab Layout" check-box to allow you to make a tab unique to that product and click Add to add one. In the little content editor that appears inside of the new tab panel, paste in the table code from before and make any changes that you need, like adding HTML!

  5. Once you've got that working, you can disable the automatically generated "Additional Information" tab simply by removing it from the same Tabs panel where you added your new one.

Note: Using this method means that the values in the new tab won't be updated automatically if you change the product's metadata (ie, shipping weight, stock number and etc.). If you need this, you could have separate tabs for dynamic and static product attributes.

Good luck,

Pt.

Other Answer2

On further investigation, it turns out that you actually can put HTML in product attributes by adding a bit of code to your functions.php file and setting up your own GLOBAL attributes first. This is the code that WooThemes support advised us to add to our childtheme's functions.php:

foreach ( array( 'pre_term_description' ) as $filter ) {
    remove_filter( $filter, 'wp_filter_kses' );
}

foreach ( array( 'term_description' ) as $filter ) {
    remove_filter( $filter, 'wp_kses_data' );
}

Note: I haven't tried this yet because I solved my problem via the method used in my first answer, but it is the way the authors of WooCommerce recommended doing it.