Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Has anyone used the "WooCommerce Layered Nav" widget. I wonder if the attributes could be visible on the single product page?

share|improve this question

closed as off-topic by Pieter Goosen, birgire, Rarst Jun 16 at 13:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

You can list all the attributes of a product by putting the following code in a template file:

global $product;
$product->list_attributes();
share|improve this answer
    
I enter this code in the single-product.php page but nothing happens, I'm doing something wrong can you help me? –  Dime Nov 9 '12 at 9:24
    
This I found on the official site woocommerce "The layered navigation widget will only appear on product archives". I hope there is a way to solve this –  Dime Nov 9 '12 at 13:11
up vote 0 down vote accepted

Finally i solve this problem:

<?php if (is_singular() ) : ?>

    <?php foreach ($attributes as $attribute) : ?>
        <h3><?php echo $woocommerce->attribute_label( $attribute['name'] ); ?></h3>
        <ul>
            <li><?php $values = woocommerce_get_product_terms( $product->id, $attribute['name'], 'names' );
                    echo apply_filters( 'woocommerce_attribute', wpautop( wptexturize( implode( ', ', $values ) ) ), $attribute, $values ); ?></li>
        </ul>
    <?php endforeach; ?>
<?php endif ?>
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.