Title: Make the attributes links?
Last modified: August 22, 2016

---

# Make the attributes links?

 *  Resolved [Cantdosleepy](https://wordpress.org/support/users/cantdosleepy/)
 * (@cantdosleepy)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/make-the-attributes-links/)
 * Hi Isabel,
 * Is there a way to make the attributes links? For example, you can use the Ajax
   layered nav to filter things according to attribute, which returns links like
   this:
 * /shop/?filter_attribute-type=73
 * Is there a way on the single product page to make the present attributes into
   these kinds of links?
 * thanks,
    Mike
 * [https://wordpress.org/plugins/woocommerce-show-attributes/](https://wordpress.org/plugins/woocommerce-show-attributes/)

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [isabel104](https://wordpress.org/support/users/isabel104/)
 * (@isabel104)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738767)
 * Hi,
 * WooCommerce no longer registers the attributes as custom taxonomies. Creating
   links was easy when they were taxonomies. There is no easy way to generate a 
   link for these attributes.
 * The easiest way to get something similar would be to use product tags. The product
   tags would be automatically placed on the product page, and they will automatically
   link to their archive pages.
    I hope that helps.
 *  [MShaner](https://wordpress.org/support/users/mshaner/)
 * (@mshaner)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738823)
 * Not to sound obtuse, but isabel104 are you saying that since WooCommerce no longer
   registers the Product Attributes as custom taxonomies there’s not only no easy
   way to generate a link to these attributes … that there’s also (by extrapolation)
   no easy way to actually create order(s) based on customer(s) product customization
   choice(s)?
 * Why, then, does WooCommerce not ‘allow’ for custom taxonomies for this very purpose?
   Or do they via other plug-in(s)?
 * Thank you in advance for your time and your clarity.
 *  Plugin Author [isabel104](https://wordpress.org/support/users/isabel104/)
 * (@isabel104)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738826)
 * To allow a customer to select a product customization, you might want to use 
   Product Variations. Variations allow a customer to select a color, size, or any
   other type of variation that you set up. See WooCommerce [Product Variations](http://docs.woothemes.com/document/variable-product/).
 *  Plugin Author [isabel104](https://wordpress.org/support/users/isabel104/)
 * (@isabel104)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738861)
 * You now have the option to show attributes as links (as of version 1.4.2). There
   are some conditions. Please see the [release notes](http://isabelcastillo.com/docs/woocommerce-show-attributes-1-4-2-is-released).
 * **Correction:**
    Above, I said:
 * > WooCommerce no longer registers the attributes as custom taxonomies.
 * This is wrong. “Global Attributes” are registered as taxonomies, but “Custom 
   product attributes” are not. Global Attributes are those which are first created
   in Products -> Attributes. “Custom product attributes” are created directly in
   the Edit Product page.
 * I hope this helps.
 *  [Rebastion](https://wordpress.org/support/users/sebh/)
 * (@sebh)
 * [11 years ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738864)
 * Okay sorry to dig this up but I don’t really see this answered anywhere: how 
   to I make my product attributes clickable? For example I list DVDs and they have
   languages “German, English”. I want each of those clickable so the visitor sees
   a list of items with language German, or language English. I can’t well generate
   Categories for all kinds of attributes, plus… they won’t be listed there either.
   The same with Tags, they would be confusing without the context “Attribute: Value”
 *  [Rebastion](https://wordpress.org/support/users/sebh/)
 * (@sebh)
 * [11 years ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738865)
 * The answer lies in /plugins/woocommerce/templates/single-product/product-attributes.
   php
 * and someone with better php skills than me oughta be able to modify the code 
   there to make attributes be linked with the help of
 * [http://biostall.com/listing-linking-and-refining-by-woocommerce-attributes](http://biostall.com/listing-linking-and-refining-by-woocommerce-attributes)
 * and / or
    [http://themeforest.net/forums/thread/woocommerce-add-links-to-attribute-values/94924](http://themeforest.net/forums/thread/woocommerce-add-links-to-attribute-values/94924)
 * and / or
 * [http://docs.woothemes.com/document/display-product-attribute-archive-links/](http://docs.woothemes.com/document/display-product-attribute-archive-links/)
 * anyone? would greatly appreciate that help. I just cant make sense of these foreach
   loops, my php skills are too limited
 *  [Bernhard Gronau](https://wordpress.org/support/users/quasel/)
 * (@quasel)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738866)
 * hi did just assemble a quick solution – might not be perfect e.g variable naming–
   add to a plugin or to your themes functions.php ( Tested with storefront )
 *     ```
       function links_for_woocommerce_attribute( $content, $attribute, $values) {
       global $product;
       	if ( $attribute['is_taxonomy'] ) {
       		$terms = wc_get_product_terms($product->id, $attribute['name']);
       		$values = array();
       		foreach ($terms as $term) {
       		    $values[] = '<a href="'.get_term_link($term->slug, $term->taxonomy).'">'.$term->name.'</a>';
       		}
       	} 
   
       	return wpautop( wptexturize( implode( ', ', $values ) ) );
       }
       add_filter('woocommerce_attribute', 'links_for_woocommerce_attribute', 11, 3);
       ```
   
 *  [Bernhard Gronau](https://wordpress.org/support/users/quasel/)
 * (@quasel)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738867)
 * antoher way would be to change the tempalte itself …
 *  [Rebastion](https://wordpress.org/support/users/sebh/)
 * (@sebh)
 * [10 years, 12 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738868)
 * I use this, works like a charm
 * [https://gist.github.com/mikejolley/e2e85f8883776211681c](https://gist.github.com/mikejolley/e2e85f8883776211681c)
 *  [Jonas Lundman](https://wordpress.org/support/users/jonas-lundman/)
 * (@jonas-lundman)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738870)
 * To answer the main question, here is our solution:
 *     ```
       if ( $attribute['is_taxonomy'] ) {
       					$landing = 56; // Product category id if y wanna use that instaed of Shop root
       					$ids = wc_get_product_terms( $product->id, $attribute['name'], array( 'fields' => 'ids' ) );
       					$filter_variable = str_replace('pa_', 'filter_', $attribute['name']);
       					$url = get_permalink( woocommerce_get_page_id( 'shop' ) );//get_term_link( intval($landing), 'product_cat' );
   
       					$urls  = array();
       					$links  = array();
   
       					foreach ( $ids as $id ) {
       						$url = add_query_arg($filter_variable, $id, $url);
       						$urls[] = esc_url( $url );
       					}
   
       					$values = wc_get_product_terms( $product->id, $attribute['name'], array( 'fields' => 'names' ) );
       					$c = 0;
       					foreach ($values as $name) {
       						$links[] = '<a href="'.$urls[$c].'">'.esc_html($name).'</a>';
       						$c++;
       					}
       					echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $links ) ) ), $attribute, $values );
   
       				} else {
   
       					// Convert pipes to commas and display values
       					$values = array_map( 'trim', explode( WC_DELIMITER, $attribute['value'] ) );
       					echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values );
       }
       ```
   
 *  [Rob Bertholf](https://wordpress.org/support/users/bertholf/)
 * (@bertholf)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738872)
 * I used:
 *     ```
       // Add Hyperlinks to Attributes in Additional Information Tab on Product Page
       add_filter ('woocommerce_attribute', 'rb_link_attributes', 10, 3);
       	function rb_link_attributes($attributes_string, $attribute, $terms) {
       		global $post;
       		$taxonomy = get_taxonomy( $attribute['name'] );
   
       		if ( $taxonomy && ! is_wp_error( $taxonomy ) ) {
       			$attribute_string = '';
       			$terms = wp_get_post_terms( $post->ID, $taxonomy->name );
   
       			if ( !empty( $terms ) ) {
       				foreach ( $terms as $term ) {
       					if (strlen($attribute_string) > 0) {
       						$attribute_string .= ', ';
       					}
       					$archive_link = get_term_link( $term->slug, $attribute['name'] );
       					$attribute_string .= '<a href="' . $archive_link . '">'. $term->name . '</a>';
       				}
       			}
       		}
       		return '<p>'.$attribute_string.'</p>';
       	}
       ```
   
 *  [hardik](https://wordpress.org/support/users/hardikp/)
 * (@hardikp)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738873)
 * Hi Rob Bertholf,
 * You are a hero man.
 * Your code works perfect for me.
 * Thanks dear.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Make the attributes links?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/woocommerce-show-attributes_d1b9b7.
   svg)
 * [WooCommerce Show Attributes](https://wordpress.org/plugins/woocommerce-show-attributes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-show-attributes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-show-attributes/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-show-attributes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-show-attributes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-show-attributes/reviews/)

## Tags

 * [attribute](https://wordpress.org/support/topic-tag/attribute/)
 * [filter](https://wordpress.org/support/topic-tag/filter/)
 * [links](https://wordpress.org/support/topic-tag/links/)
 * [single product](https://wordpress.org/support/topic-tag/single-product/)

 * 12 replies
 * 8 participants
 * Last reply from: [hardik](https://wordpress.org/support/users/hardikp/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/make-the-attributes-links/#post-5738873)
 * Status: resolved