How to get variants images manually
-
How to get variants images manually in variable.php template here is my code
$terms_swatch = get_terms( 'pa_choose-type' ); $count = count( $terms_swatch ); if ( $count > 0 ) { echo '<ul>'; foreach ( $terms_swatch as $term_swatch ) { echo '<li>' . $term_swatch->name . '</li>'; echo '<li>' . $term_swatch->term_id . '</li>'; $image = get_term_meta( $term_swatch->term_id, 'image', true ); echo $image; } echo '</ul>'; }
Here “pa_choose-type” is my image attribute type .
Above code giving me term name,id , term_meta (image id) successfully . But how to get full image URL here…?
Please help.
- The topic ‘How to get variants images manually’ is closed to new replies.