WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Trouble displaying attribute values (1 post)

  1. cerstrand_mace
    Member
    Posted 9 months ago #

    I'm using Woocommerce for product display on a website I'm working on. When I'm fetching my custom attribute values I get what seems to be random empty strings between the values. Watch an example here:

    http://tec.macework.se/produkt/premium-short-sleeve-jersey-white/

    Here's my code for fetching the values:

    <?php
      $atts = get_the_terms( $product->id, 'pa_attribute-1');
    
    	foreach ( $atts as $att ) { ?>
    	 <li>   <?php echo $att->name; ?> </li>
    
    <?php } wp_reset_query(); ?>
    
    <?php $atts = get_the_terms( $product->id, 'pa_attribute-2');
    
    foreach ( $atts as $att ) { ?>
    
    <li>   <?php echo $att->name; ?> </li> 
    
     <?php }  wp_reset_query(); ?>
    
    <?php
    $atts = get_the_terms( $product->id, 'pa_attribute-3');
    
    foreach ( $atts as $att ) { ?>
    
    <li>   <?php echo $att->name; ?> </li> 
    
    <?php } wp_reset_query(); ?>
    
    <?php $atts = get_the_terms( $product->id, 'pa_attribute-4');
    
     foreach ( $atts as $att ) { ?>
    <li>   <?php echo $att->name; ?> </li> 
    
     <?php } wp_reset_query(); ?>

    What's up with the empty strings?

    http://wordpress.org/plugins/woocommerce/

Reply

You must log in to post.

About this Plugin

About this Topic