Hi Sean,
I’m sorry but this is currently not conveniently possible.
The plugin will always display all attribute descriptions of the current product.
The only solution I can think of is the following hacky code, which adds a filter that returns an empty content of an attribute, if a content of the same attribute has already been filtered previously. I did not the test the code and you’d have to adjust it to your needs.
<?php
class MyFilterClass {
private $attribute_contents = array();
private $num_contents = 1;
private $attributes_filter = array('myterm1', 'myterm2');
public function __construct() {
add_filter('woocommerce_product_attribute_tab_content_term', array($this, 'display_only_first_content', 10, 3);
}
public function display_only_first_content($content, $term, $attribute) {
if (in_array($attribute['name'], $this->attributes_filter)) {
if (isset($this->$attribute_contents[$attribute['name']]) {
if ($this->$attribute_contents[$attribute['name']] >= $this->num_contents) {
return '';
}
$this->$attribute_contents[$attribute['name']] += 1;
}
$this->$attribute_contents[$attribute['name']] = 1;
}
return $conent;
}
}
new MyFilterClass();
Kind regards,
Mike
-
This reply was modified 6 years, 2 months ago by mjke87.