0

I don't seem to be able to find any information on whether this is possible. Instead of a piece of text as an attribute I would like to display a tick symbol.

i.e. My attribute is called Vegetarian the value is "yes". Instead of displaying the word "yes" I would like to display a tick symbol.

Does anyone know where I could make an edit to achieve this?

MrFox
  • 169
  • 1
  • 13
  • What you probably want to do is make the radio selection an image... http://stackoverflow.com/a/17541916/3739498 – Aibrean Dec 14 '15 at 12:49
  • Thanks, I'm not using a radio button. This is a text value – MrFox Dec 14 '15 at 14:31
  • Can you provide the output of the code? – Aibrean Dec 14 '15 at 19:51
  • I'm not sure which file this code is in. That is what my question is: "where can I make the edit?" I was hoping someone with some Woocommerce experience could tell me. – MrFox Dec 15 '15 at 09:05
  • Attributes by themselves aren't selections. You have to make it a variation to be a selection. – Aibrean Dec 15 '15 at 11:56

1 Answers1

0

Ok, I've found the file that needs to be edited to achieve this. You need to make a copy and save it to your template in /single-product/product-attributes.php

After the foreach loop paste:

<?php global $product;
      $vegetarian = $product->get_attribute( 'vegetarian' ); ?>

<?php if($vegetarian){
            echo '<li>Vegetarian <i class="fa fa-check-square-o"></i></li>';
      }?>

Then make sure that the Vegetarian attribute is not "Visible on the product page" by unchecking that box in the product options in admin. Now it will appear with a tick at the end of the attribute list.

i.e.

Attribute: attribute value

Attribute: attribute value

Vegetarian: <i class="fa fa-check-square-o">

MrFox
  • 169
  • 1
  • 13