woothemes/woocommerce — Issue #768: Add filter to attribute value
Author: feedmeastraycat
Created: 2012-03-06 13:49:53+00:00
State: open

Would be great if you could filter the attribute values. With that you could put in your own search/reaplace features. Even better would obviously be if you could put in actual short codes.

I'm adding Age Rating and I just put in an img tag in plain html code, but it would be better if I could add "[age_rating provider=PEGI value=7]" for example.

So instead of this in WC_Product->list_attributes():

$value = explode('|', $attribute['value']);
$value = implode(', ', $value);
echo wpautop(wptexturize($value));

You could have something like:

echo apply_filters('woocommerce_attribute', $attribute['name'], $attribute['value']);

And you could add your own filter to split pipe, and impload on comma and do wpautop() and wptexturize(). Which "a dev" easily could remove, as a bonus feature, if this is something "the dev" don't want. Or for example "the dev" don't want pipes to be changed to commas. :)