WordPress.org

Forums

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

  1. cerstrand_mace
    Member
    Posted 1 year 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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic