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
add comment

2 Answers

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
add comment
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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